- Home /
Transform.rotation in degrees instead of 0 to 1
Hi, when checking transform.rotation.y of an object I get a value between 0 and 1 but I need the rotation in degrees as shown in the Transform section of the Inspector. How to check rotation in degrees to use this value? Thanks in advance
Answer by Chris D · Jul 28, 2011 at 07:02 PM
Use transform.eulerAngles instead.
Rotation
is supposed to be a quaternion so when you call your code, you're just getting the y
component of that and that's not very useful unless you know your quaternion systems...
... I found that in the documentation but it didn't work...cause I use a wrong variable (silly me). Thanks anyway for your rapid answer, it helps me to re-read my code and find the mistake.
Answer by Hendrys · Jul 28, 2011 at 08:26 PM
If eant the Angles you should use
transform.rotation.eulerAngles
This one is the vector you see in the inspector
Hope it helps
Almost right ;)
In the inspector you see the local rotation not the worldspace rotation.
transform.localRotation.eulerAngles
is what you see in the inspector
Your answer
Follow this Question
Related Questions
Get object rotation for x axis in degrees (360) 1 Answer
What is the most efficient way to rotate an object? 3 Answers
How to rotate 90 degrees from 270 degrees to 0 with lerp? c# 1 Answer
Trying to get the angle of a camera object based on players forward, is not distance independent 0 Answers
Limit gameobject rotation to -480 and 480 degrees? 2 Answers