I’m using an educated guess here, but I think what is happening is Gimbal Lock. I think two of your axes are coinciding when you get to a certain view rotation and guessing the Prop to Roll/Pitch instead of yaw. What happens if you use TeleportTo instead of MoveTo?
Quick speculation here, but given that the Y/Z axis are reversed from the ‘usual’ 3D implementation - is it possible that the gimbal lock we normally don’t encounter except when looking straight up or down (along the vertical axis, unusual in an FPS and often ignored as a problem) is instead happening along the X or Y axis?
If they’ve copied a standard 3D implementation of these functions without swapping the Y/Z variables, this is what we would expect to see: gimbal lock problems in ‘everyday’ use-cases.
EDIT: I guess I hi-jacked the thread, apologies: Here’s something a bit more practical. Try rotating your ‘following’ model around the Y axis then offset the return value from GetViewRotation to compensate. If it does turn out to be gimbal lock, this will move the lock position and you can try to move it somewhere harmless to your design.
EDIT2: I’ve had strange issues with rotation in general and I made a list of possible causes. One of them is collisions… Is it possible that your following item is bumping into the player collision or some other collision object? That might explain the way it appears to bump around when it goes ‘crazy’ too…
What if you store the previous value of GetViewRotation() and the current value to find the difference in yaw between the two rotations. You could use GetYawPitchRollDegrees() Then subtract the current yaw from the previous and apply a local rotation: ApplyLocalRotationZ(DegreesToRadians(YawDiff))
Just would need to make sure the origin of your light is in the correct place for it to rotate the way you want it to.
I’m running some experiments with Rotation and can definitely say:
there is Gimbal Lock
it’s aligned with the Vertical Axis
it doesn’t happen if you use ApplyPitch instead of MakeRotationFromYawPitchRoll
So the suggestion above will probably work to avoid it… if that is indeed your problem.