Download

Getting rotation on a single axis

I’m trying to calculate the pitch of a skeletal socket, but I want to calculate it independent of the pitch and roll. I can get the transform of the socket in parent bone space, but just looking at the euler is problematic because of the order in which rotation is calculated (roll, pitch, and yaw if I understand correctly.) The result is that the pitch is being affected by the other values.

Since I’m able to get the transform of the socket, its quaternion , and its rotation matrix, how can I use this data to calculate the pitch independent of the yaw and roll?

Just take only Pitch from your Rotation you are using.


YourRotation.Pitch

As I mentioned above, I can’t do this because pitch is affected by yaw and roll due to how Unreal calculates euler angles.

I know this maybe isn’t an optimal solution, but maybe convert it into a direction vector first?

FVector DirectionVector = YourRotation.Vector();
float PitchRotation = DirectionVector.Rotation().Pitch;

I’m not sure if the .Vector() function takes into account the other variables you mentioned but it’s at least worth a shot.