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 I've actually been kind of enjoying how Godot handles transforms. It's not the same as Unity. Basically, you have an origin vector, which is the position, then three other vectors that describe the rotation of the object on each of those axes. I don't actually understand it enough yet to explain or teach it well. But every time I deal with them, I walk away thinking, "Huh, yeah, that makes sense actually." Whereas with Unity, I would alwaya end up at quaternions and be like, "Wat." 🤷

@MBoffin @peterdrake Godot is just storing the translation (origin/position) separate from the "basis" which is a 3x3 matrix capable of storing rotation, scale, and (most important, something Unity can't handle:) shearing. It's actually a bit more complicated than Unity's system, but it offers more flexibility, and the access members in Node3D make it easier to manipulate.

@peterdrake But really, you just shouldn't use euler angles ever because they're so error-prone. Learning to use the quarternion rotations saves you a lot of headache in the future.

@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.

@tjheuvel docs.unity3d.com/ScriptReferen

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.

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.