- Home /
Question by
Averius · Oct 09, 2015 at 09:04 PM ·
rotationeulerangleseuler angles
Compare euler angles to check if they describe the same rotation.
The euler angles (0, 180, 0) describe the same rotation as the angles (180, 0, -180). What would be the best way to find out for two given euler-rotations, if they restult in the same rotation?
rotation.png
(169.8 kB)
Comment
Best Answer
Answer by dkjunior · Oct 09, 2015 at 11:59 PM
You can use Quaternion.Angle to compute the angle between two rotations:
Quaternion a = Quaternion.Euler (0f, 180f, 0f);
Quaternion b = Quaternion.Euler (180f, 0f, -180f);
float angle = Quaternion.Angle (a, b);
bool sameRotation = Mathf.Abs (angle) < 1e-3f;
Your answer
![](https://koobas.hobune.stream/wayback/20220612040656im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to properly reference a Euler? 1 Answer
,How to clamp my turret rotation? 1 Answer
ConfigurableJoint - angular positions (rotation) problem 1 Answer
Set rotation values equal to 0 5 Answers