Coding a hover state

Im trying to make a hover state with a pc.EVENT_MOUSEMOVE hovering over a plane with a collider.

Hovering over my button starts the mouseOver(); function using the Picker tutorial. However I’m having a hard time getting mouseCancel(); to start.

This is my code:

PickerRaycast.prototype.mouseOver = function (e) { 
    var from = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.nearClip);
    var to = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.farClip);
 
    this.app.systems.rigidbody.raycastFirst(from, to, function (result) {
        var pickedEntity = result.entity; 

        pickedEntity.script.button.mouseOver();
        console.log("Over");
        
        if (result === null) {
            pickedEntity.script.button.mouseCancel();
            console.log("Cancel");
        }
    });  
};

I’m a Playcanvas noob and loving it so far just getting hung up on this one.
Thanks for any insight!indent preformatted text by 4 spaces

Can you share the project or a sample of the project with the same problem please?

Please post tidy code to help reading it (I’ve edited your post tidying it up, you can edit it to see how code tags are done), it’s hard to read unformatted code.

Have you checked console for errors and used catch exceptions with pauses to debug the issue?
On debugging read this: http://developer.playcanvas.com/en/user-manual/scripting/debugging/

I have tried to use mouse over in my map project but i don’t remember if i used it or not i think i forfaited coz i had too many collisions and slow down the project that a look here, maybe there is some leftover somewhere https://playcanvas.com/project/368737/overview/map-test