- Home /
Euler angle rotation in self space problem.
I have a Quaternion rot where I want to rotate in the Y axis so I use rot.eulerAngles.y and it works nicely in world space. Now I want to rotate on the Y axis in self space where the object is rotated in the x axis by 10 degrees. How do I calculate the new euler angle around Y axis. Is there an equation or easy way to work around it? Thanks.
Answer by Paulius-Liekis · Oct 26, 2010 at 12:21 PM
set localEulerAngles (IIRC there is such thing)?
Edit:
I though you have you object parented to something, but it sounds like you have set some rotation on your object already and you want to set some additional rotation on it (instead of overriding it).
You should do something like this:
localRotation = Quaternion.Euler(10, 0, 0) * Quaternion.Euler(0, rotationAroundYAxis, 0);
I tried that but it rotates in world space, am I doing something wrong?
It works! But how is that different from Quaternion.Euler(10,rotationAroundYAxis,0)? Thanks for the help.