Relative Joint 2D weird reaction to full rotations
What i'm trying to do: I'm making a 2d top-down game in which the player holds a long spear. The player always looks at the mouse, and the spear always tries to match the players rotation, but can be stuck behind a wall/inside an enemy. The spear can also be used to push around objects by rotating.
How I tried to make it: I attached the spear to the player with both a hinge joint and a relative joint.
The issue: Everything works fine, except when the mouse crosses the negative x axis (when the players rotation jumps form -180 to 180) the spear makes a full 360 degrees turn.
What i've already tried: Taking %360 of both angles didn't fix it. I also tried adding 360 degress to the angles so one is always bigger, with no succes.
Is there any way to fix this, or do i have to write my own joint code to make things work?
Answer by ForgeSheep · Nov 01, 2018 at 08:10 PM
Same problem and my solution: https://forum.unity.com/threads/relativejoint-2d-funny-behaviour-when-rotating-360.504394/