Skip to main content
1 of 2
theCodeHermit
  • 59
  • 1
  • 2
  • 12

Unity get object rotation

I have an object which can be rotated at 0, 90, 180, 270 degrees. I am using this to get the rotation data:

transform.eulerAngles.x

However that code keeps ignoring 180 degrees and instead shows 0 or some weird calculation which is basically zero (smth like -93+2323232-4)

I have read about quaternions, eulers and unity rotations in general and every time I curse my life when I have to work with unity rotations...

Is there any human readable and efficient/easy way to get the exact rotation the object has ? Or at least to get these values from 0 to 360.

theCodeHermit
  • 59
  • 1
  • 2
  • 12