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