# Wrong .rotation.eulerAngles.x output

I can't seem to read rotation angles. I have tried lots of things and this line of code seemed most promising to me but doesn't give right output.

It reports angles of: 360 to 270 in the first quadrant. 270 to 360 in the second quadrant. 0 to 90 in the third quadrant. 90 to 0 in the fourth quadrant.

I need these rotations to implement an inertial dampener like in Elite Dangerous to my spaceship.

Relevant code: void fixedupdate() { var rot = tr.rotation.eulerAngles; var deltaXRotation = rot.x - lastXRotation; var lastXRotation = tr.rotation.eulerAngles.x; }

what exactly do you want to achieve? be more clear please.

Unity rotations are in order yxz. So if y doesn't stay fixed at 0, x can be funny. They use a left-handed system, so x rotates clockwise looking from the *right* side. But as Bunny## alludes, many calculations are easier using pure quaternion math.

**Answer** by Bunny83
·
Jan 21, 2018 at 04:59 PM

EulerAngles do are not a unique representation of an orientation in space. Unity stores the rotation of objects as Quaternions. The conversion from Quaternion to eulerAngles is not unique. For example the euler angles rotation (0, 0, 0) is the same as (180, 180, 180) or (-180, 180, -180). Eulerangles suffer from gimbal lock at a rotation of (90,0,0) or (-90,0,0) where you loose one degree of freedom. Quaternions do not have this problem. You should base all your calculations on direction vectors.

If you want to know the current rotation speed around the objects **local** x axis you should store either the objects up or forward vector. The next frame you can project the saved vector onto the y-z plane and calculate the angle between the two vectors (the projected up and the current up vector) by using Vector3.SignedAngle.

However if you want inertial damping you can just damp the rigidbodies angularVelocity by multiplying it with a damping multiplier. However you can also just use the angular drag. It highly depends on your exact desired behaviour.

Thanks but can you please specifiy how to work with those vectros?

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

I need help in rotating cube by 90 degree with swipe in all axis 0 Answers

How to flip euler angle without flipping axis 0 Answers

What is wrong with my code? C# beginner 1 Answer

How do you change your z axis in a movement script. 1 Answer

How to access y rotation of an object as a variable or value 1 Answer