The inspector shows certain rotation values for Game Objects.
I would like to work with these instead of the eulerAngles (which are the rotation values that I can access by a script).
To get these rotation values shown by the Inspector, I found out that the eulerAngles of the game object's localRotation could be of help.
I'm not sure if my approach is correct.
Can somebody tell me what I'm actually trying to do here (I guess there is a name for it) and how to do that correctly?
My current approach is this:
private float EulerToRotation(float value)
{
if (value > 180)
{
return value - 360f;
}
else if (value < -180)
{
return value + 360f;
}
else
{
return value;
}
}
transform.localEulerAngles
returns the euler angles of the local rotation, that is, the rotation relative to the parent object. What is the difference between these angles and what you want? \$\endgroup\$