How to rotate things to the mouse in a shooter game

Hi, I’m having problem making a mechanic, can anyone help me?
It’s like the mechanics of this game, a player carries a weapon that is at a certain distance from him and the two are always rotated to the mouse

Alternatively, the weapon can be added as a child object to the player. Then the child object will be in the parent’s coordinate system and will move and rotate depending on the parent. Example: Parent/child

Player rotation behind the mouse cursor can be seen in forum posts, for example here: How can you get an object to point to the mouse pointer? - #8 by britzl

Or look at an example of the implementation of such mechanics:
Web demo: Rotate and Move 0.0


I added a “look-at” example to our examples section: Look at


hi, thank you very very very very very much
It worked

1 Like

thanks, worked too and I finally find the github of britzl


finally this project evolved, I was almost giving up on the defold
what bad eyesight doesn’t do