I have a script trying to get the gun aim at the target instead of the origin:
It's partially working.
but when I get too close with the mouse the player starts spinning
I would appreciate a help regarding why it happens and how to fix it.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityI have a script trying to get the gun aim at the target instead of the origin:
It's partially working.
but when I get too close with the mouse the player starts spinning
I would appreciate a help regarding why it happens and how to fix it.
You're using image_angle
(the current rotation) to calculate the new rotation for your character, this is what's making it spin - it just keeps summing every frame.
If your goal is to make the character's weapon point at the mouse, take a look at the answers here.