I think I need a serious re-understanding of how I can use rotations and what in my game.
Perhaps part of the issue is that my game is using a locked Axis
But anyway, lets say I have an enemy and it has a turret and I want it to face my player, or more specifically, to know whether my player is to the left or right of it. (so it knows to turn left or right)
My instinct is to break the rotator and compare angles, but the angles in the rotator flip-flop (I understand why this happens, converting from quats to euler internally) but I don’t have a clue how to work with it
Here are some images showing what is happening, what I can’t deal with. The black line is a debug line and I am using the lookat rotation to get the angle for my turret to face
When I cross the centreline the rotation flips to 180 degrees of what it should be
I don’t know how to deal with this? Part of my game is that I want things to be physically controlled, for example, my turret will use a physics constraint and a driver to a specific angle, for example. But how can I know what angle to get it to turn to, because when I try to get the angle this kind of thing happens? Because I am using locked axis it prevent rotation on all but the locked axis so things flip and flop and shake and it’s messy.
How do I deal with this?