Every Unity GameObject has an associated transform, which comprises three vectors: position, rotation, and scale.
If you want to change the rotation, you use the Rotate method.
If you want to know what the rotation is, you'd think you'd access the rotation field. There is such a field, but it's not the one you want. You need to use eulerAngles.
🤦♂️
#unity #unity3d #GameDev #naming
Behind the scenes, rotation is actually a Quaternion. I understand there are reasons for this, but displaying it in the Inspector as Rotation (with three components), and setting it using Rotate (with a Vector3 and an angle) made me expect that rotation would be a Vector3.
@tjheuvel https://docs.unity3d.com/ScriptReference/Transform-rotation.html
Technically this is a *property* of the Transform, so I may be wrong about the underlying representation.
@tjheuvel @peterdrake We actually store it as both, but the quaternion version is the source of truth.
@superpig @peterdrake Thanks for the extra info!
@peterdrake https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Transform/ScriptBindings/Transform.bindings.cs#L57
Yeah not too much we can learn from that.