- Home /
Why are localRotation and rotation the same
The question above, I change the local rotation by a Quaternion and both transform.rotation && transform.localRotation are the same. This include the euler angles. If i cahnge one the other follows, why is that, I though localRotation was local and rotation was global. Can someone help me out.
Answer by Muuskii · Aug 10, 2012 at 04:07 PM
Is your GameObject parented to anything? Transform.localRotation is;
The rotation of the transform relative to the parent transform's rotation.
And Transform.rotation is basically the same, except the "parent" is the world root. So if your GameObject isn't parented to anything localRotation will be the same as world Rotation.
If it is parented, and that object has a rotation of Quaternion.identity you will have the same effect.
Hope this has helped.
Thanks
well it is parented. my model is parented to a ImageTarget. ( I am using qcar augmented reality sdk)
I checked just now, The parents local euler angles do not change (0,0,0) and parents rotation is 0,0,0,1 so that doesnt change either. I haven o idea why local rotation and gloal rotation are the same.
Like I said, if the parent's rotation is Quaternion.identity (0,0,0) then parent.forward == Vector3.forward
Think of it this way; transform.rotation = transform.localRotation + parent.rotation;
When parent.rotation = (0,0,0) then it translates to:
transform.rotation = transform.localRotation;
So what you are saying is if my parents roation was slighlty different transform.roation would be different that transform.localRotation?