This question is a bit hard to explain what I’m running into, so bare with me if I don’t describe it correctly!
I have an actor component that executes some functions based on the rate of change of rotation. Currently, to get this rate of change, I get the actors GetComponentRotation() to get the current rotation in world space, and then the next frame, I get it again and get the difference in the pitch/roll/yaw to determine the change in degrees per frame, which I can then divide by deltaTime to get change in degrees per second.
This works decently well until pitch approaches 90/-90. The problem here is that as pitch approaches this value, the roll value in the actor component’s rotation starts to rise. My gyroscope implementation then sees this as a rotation of 20-30 degrees per frame, causing unintended behavior in the component. This is troublesome, because the actor, in its own reference frame, only changed pitch by 1 degree.
I’m pretty stumped on how to resolve this issue. For my implementation, I don’t actually care what the pitch/roll/yaw values are, only the components change in reference to itself since last frame. Any ideas on pushing forward with this?