How to rotate things to the mouse in a shooter game

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