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.

πŸ€¦β€β™‚οΈ

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.

@peterdrake > Every Unity GameObject has an associated transform, which comprises three vectors: position, rotation, and scale

Citation needed, why do you think that behind the curtains its a quaternion? Rather than storing say a localToWorld matrix.

Follow

@tjheuvel docs.unity3d.com/ScriptReferen

Technically this is a *property* of the Transform, so I may be wrong about the underlying representation.

Β· Β· 1 Β· 0 Β· 0

@tjheuvel @peterdrake We actually store it as both, but the quaternion version is the source of truth.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.