- Home /
[2d Platformer] How to rotate the arm so that the gun faces the mouse?
The point where the shots from the gun come from is at a different position than the arm. For example, here the shots from the gun shoot out from above the arm.
Currently, I am rotating the arm and gun by pointing the arm towards the mouse position. However, this causes the shots from the gun to not line up with the barrel of the gun.
How can I make it so that the gun is always pointing towards the mouse?
sniperrifle.png
(23.4 kB)
Comment
If your target position to rotate towards is the cursor position, you offset that position by the difference between arm and gun.