Vixen
02b45cc4
csharp
public static class EulerAngles

Rotations as the three numbers a person edits.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Only the editor does this, and only at the edge. Nothing in the engine stores Euler angles — Quaternion's own remarks say why — but an inspector has to show three boxes, because "rotate this fifteen degrees about Y" is a thing people say and (0, 0.13, 0, 0.99) is not.

The order is Quaternion.FromYawPitchRoll's, which is yaw about Y, then pitch about X, then roll about Z. It has to be: three different orders give three different rotations from the same numbers, and an inspector that read them back in an order the engine does not write them in would rotate an object every time it was redrawn.

⚠ Gimbal lock is resolved, not avoided. At ninety degrees of pitch, yaw and roll describe the same turn and only their sum is recoverable; the whole of it is put in yaw and roll is reported as zero. That is a real loss of the numbers the user typed, and it is why the stored value stays a quaternion: only the display round-trips imperfectly, never the model.

Methods (2)

  • public static Quaternion ToRotation(Vector3 degrees)

    The rotation described by three angles in degrees.

  • public static Vector3 FromRotation(Quaternion rotation)

    The three angles, in degrees, that would rebuild a rotation.

Used by (2)

  • EulerTestsVixen.Editor.Inspector.Tests
  • QuaternionDrawerVixen.Editor.Inspector