Quaternion and Euler angle confusion

snkarsnkar Member

I have been working with Quaternions in UrhoSharp to do some 3D modelling work. I am having a confusion around the following code:

using Urho;

var q = Quaternion.FromAxisAngle(Vector3.UnitY, +45f);
var q2 = new Quaternion(0f, +45f, 0f);
var outputAngle = q.ToEulerAngles();
var outputAngle2 = q2.ToEulerAngles();

Console.WriteLine(outputAngle); // (0, -45, 0)
Console.WriteLine(outputAngle2); // (0, -45, 0)

What I am not being able to understand is when I am creating the Quaternion with a +45 degree rotation around the Y axis, then how is the euler angle representation showing it is -45 degree.

Please note that I am from a non-gaming background and dealing with Vectors/Quaternions for the first time. So I do not have a good enough handle on the mathematics around Quaternions or Euler Rotations. I have read up a couple of posts but still not quite able to get my head around why the angle is getting reversed in the Euler representation.

Best Answer

Answers

  • MarcoTronconeMarcoTroncone GBUniversity ✭✭

    now the nuget package it's very old, I hope @EgorBo can update it in these days

Sign In or Register to comment.