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

Hi!
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: https://github.com/britzl/publicexamples/tree/master/examples/rotate_and_move
Web demo: Rotate and Move 0.0

5 Likes

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

6 Likes

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

1 Like

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

2 Likes

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

2 Likes