Hello Gdevelop! I have a problem. In my game, the character has a gun. The problem is, if you hover the cursor on the player, it glitches like this:
I guess its because it always rotates towards the cursor. Anyone know how to fix?
The problem is that you’re aiming from the player centre to the cursor position. As you pass over the player’s centre, the angle quickly changes from one side to the other.
One way to fix this it to not rotate the gun if the cursor is within certain distance from the player’s centre. Or, in other words, only rotate the gun if the cursor is a greater than a set distance from the player centre.
1 Like