I have the following code fragment;
Code: Select all
var body = new BodyReference(BodyHandle, characters.Simulation.Bodies);
ref var pose = ref body.Pose;
pose.Orientation = Quaternion.CreateFromYawPitchRoll(input.CameraAngle, 0, 0);
Quaternion.TransformUnitZ(pose.Orientation, out var viewDirection);
Quaternion.GetAxisAngleFromQuaternion(pose.Orientation, out var axis, out var angle);
Console.WriteLine($"CS:{input.CameraAngle} VD:{viewDirection} A:{axis} ANGLE:{angle}");
CS:90.15236 VD:<0.8156362, 0, -0.5785651> A:<0, 1, 0> ANGLE:2.187765
CS:96.18495 VD:<0.9336317, 0, -0.3582342> A:<0, 1, 0> ANGLE:1.937172
CS:128.3905 VD:<0.4029752, 0, -0.9152108> A:<0, 1, 0> ANGLE:2.726827
CS:144.3713 VD:<-0.1414784, 0, 0.9899414> A:<0, -1, 0> ANGLE:0.1419543
Why is my angle variable wildly different from input.CameraAngle? If I create a Quaternion using CreateFromYawPitchRoll() and then invoke Quaternion.GetAxisAngleFromQuaternion() shouldn't I get the same numbers?
I'm confused...
Maci