Using events in update function

I am using onMousedown(event), in my code in which i am checking the mouse pressing and releasing and then i am checking the time between them in the update function. When i got the tapping time more than 1sec I am calling a raycast function with the parameter event so that i can get the screen coordinates. Now i am not getting how to get those screen coordinates in my update function which is generating from the onmousedown event.

code link : PlayCanvas | HTML5 Game Engine

Store the screen position of the mouse in a variable (eg. this.mouseScreenPos) in the callback of the mouse down event and use that variable in the update loop.

1 Like