- Home /
Difference between transform.localEulerAngles and transform.localRotation=Quanerion.Euler
I am working on a project which I have inherited, and I’m confused by the way in which two similar objects are being rotated but using different methods. There is a parent object with multiple daisy-chained children (a robot arm style link chain).
One has a script applied to each child joint and uses localEulerAngles:
transform.localEulerAngles = new Vector3(0.0f, setAngle, 0.0f);
The other has a script applied to the parent which references the children in the inspector, and uses localRotation = Quanterion.Euler:
public GameObject objectToRotate;
float setAngle;
private Vector3 axis= new Vector3(0, 0, 1);
objectToRotate.transform.localRotation = Quaternion.Euler(axis*setAngle);
What is the difference between these approaches when one uses Euler angles directly and one uses Quaterions?
Thankyou.
Answer by FlaSh-G · Feb 11 at 06:01 PM
There is no difference. You can even look up in the source code that the localEulerAngles
property just calls Quaternion.Euler
and assigns the result to localRotation
.