Smoothly continue Relative Rotation when passing 0 or 360 degrees

Hello! I’ve been trying to create a Tracking Turret inside of Blueprint coding.
I’ve managed to get smooth movement on the vertical and horizontal axis relative to the turret’s own rotation;

For example, if the turret is on a wall, an angled slope or a rotating platform, both horizontal and vertical joints are successfully restricted relative to the turret and will allow the barrel to track it’s target.

However I have found an issue when the horizontal axis passes the relative marks for 0 or 360 degrees. This cause the turret to spin the entire way around, rotating from 0 > 359 degrees instead of just 0 > -1. I’ve tried looking for similar issues but have yet to find any.

Is there any way to smoothly go from a relative rotation of 0 to 359 degrees without it needing to go the full rotation?

If it’s constantly moving in a linear fashion, you can just use ‘add local rotation’.

If you’re using a timeline, you can probably do it with ‘combine rotators’, in the correct order.

Did you ever figure this out? I’m having the same problem. Using Add Relative Rotation works fine on Z and Y axis, but stutters/stops on the X axis when it tries to cross 0 or 360…

1 Like

It’s a well known problem.

To avoid it, you can use one of:

1 Only ever add local rotation

2 Only ever add rotators together ( so don’t break open nodes and change the XYZ independently )

3 Use quaternions