[Solved]Get Euler Angles From Rotation.


Recommended Posts

currently node.GetRotation() returns the rotation in type quat, i want to make changes to the rotation is there any way i can get the rotation in euler angles like Quaternion.Euler from unity? 

Link to post

Dear @WarDuck,

Answer to your questions are hidden here


For your case you use the following.

mat3 mat3Rotation = m_quatRotation.getMat3();
vec3 vec3RotationEulerAngles = decomposeRotationXYZ(mat3Rotation);

Hope this helps.

Should Also work in C#.


Edited by rohit.gonsalves
Added C# tagging
  • Thanks 1
Link to post

Hi, @rohit.gonsalves

Thank you its exactly what i was looking for, but I am not getting the desired result.

		mat3 currentRotation = node.GetRotation().Mat3;
		vec3 eulerAngles = MathLib.DecomposeRotationXYZ(currentRotation);

This is my Function I am just printing out the current rotation like the one we see in the editor Parameters window.

In the Parameters Window

The Result In Console.

Link to post

Dear @WarDuck,

For angles you start from 0. Go clock wise 300 degrees. And then start from 0 and go anti clockwise 60 degrees (-60). Though the magnitude are different. Directions make the point same. You will end up at same point. This is perfect. Probably the function after decomposing the Euler angles returns in range of -180 to 180 or -360 to 360. Remap to range 0 to 360.

if angle < 0 

360 + angle

Again. If editor shows -90 and the result is 270. Both are same.


  • Like 1
Link to post
  • WarDuck changed the title to [Solved]Get Euler Angles From Rotation.