- Home /
This question was
closed Dec 04, 2012 at 10:55 AM by
AeonIxion for the following reason:
The question is answered, right answer was accepted
Question by
AeonIxion · Dec 04, 2012 at 09:25 AM ·
rotationlocaleulerangles
localeulerangles changes global angles?
Hi, In my scene I have a direction light. I want to be able to set the angle of the light to the ground. So I got:
RotatingLight.transform.localEulerAngles = new Vector3(xValue, 0,0);
Then I want it to rotate around my scene, so rotating around the local y-axis. I changed my code to:
RotatingLight.transform.localEulerAngles = new Vector3(xValue, yValue*360,0);
However when I play the scene it rotates around the x-axis correctly, but then it rotates around the global y-axis instead of the local y-axis. What am I doing wrong?
Comment
Best Answer
Answer by AeonIxion · Dec 04, 2012 at 10:55 AM
changed it to localRotation = Quaternion.euler(xValue, 0, 0) * Quaternion.euler(0, yValue, 0);
and it works. Not the effect i was hoping to get :(