Hello, in my game I have to compare two y-rotation values of an object before and after an action.
Little bit of my code:
Function Update()
var firstRotation = pivotPoint.transform.localEulerAngles.y; // pivotPoint is the gameObject wich I need the y-rotation values off
// after the action
var secondRotation = pivotPoint.transform.localEulerAngles.y;
rotationValue = firstRotation - secondRotation;
This works great except when the secondrotation is less or equal to 360. I've looked it up in the script refecence and it says : Don't increment Eulerangles, as they will fail when the angle exceeds 360 degrees.
That explains the problem.
If I use the Quaternions I get 4 strange numbers.
Is there any way I can convert these 4 numbers to the y-rotation value?
↧