Defold Orthographic - Get cursor pos with no input

Hi there,

I am using the britzl Defold Orthographic camera to follow a moving player object and to in the on_input function, I get the camera.screen_to_world position and set it to the cursor object.

All is good until the point where I stop sending input (mouse movement or keyboard). The thing, the player object then start to move at a constant speed (like drifting). This causes the camera to follow him, which is correct, but the cursor position is not update as the on_update is not called.

I am not sure how to solve this problem. Any suggestions?

I think in this case you should just store the raw input position (action.x, action.y etc) and compute the world position in your update.

2 Likes

Ahh, you are right.
Just saved the last position from the action and used it in the update in the camera.screen_to_world function again.

Thanks

Blockquote

1 Like