make "fake cursor" still trigger hover events #330
-
So I decided that my game would not force people to use their mouse. To do that I requested pointer lock (i.e. Unfortunately with pointer lock turned on Kaplay no longer knows where the pointer is and so the area component can't fire its How do I tell Kaplay that my synthesized pointer should be used for the hover events and/or feed the synthesized pointer's position into the mouse-hover logic? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Oh! Area doesn't fire up an event when the object is hovered. isHovering(this: GameObj) {
const mpos = isFixed(this)
? k.mousePos()
: k.toWorld(k.mousePos());
return this.hasPoint(mpos);
}, I would say you can mimic it triggering you the event (example: So, the fix is either add events for hover or add in isHovering a check for an object with the tag "mimicMouse" or something like that |
Beta Was this translation helpful? Give feedback.
yeah, I was thinking in a component anyway. But probably not doing the trigger events thing because it would implicate check isHovering on an update frame, and if you are not using it, will cause frame drops easily/