🤔

Quaternion.Euler#

Declaration#

public static Quaternion Euler(float x, float y, float z);
public static Quaternion Euler(Vector3 euler);

Description#

When working with rotations about the X, Y, and Z axes you may find it more convenient to use Euler angles instead of AngleAxis.

// 30 degrees rotation around Y.
transform.rotation = Quaternion.Euler(0, 30, 0);

In use#

Setting eulerAngles or localEulerAngles on a Transform will call this function to create the Quaternion used for rotation:

// The rotation as Euler angles in degrees.
public Vector3 eulerAngles { get { return rotation.eulerAngles; } set { rotation = Quaternion.Euler(value); } }

// The rotation as Euler angles in degrees relative to the parent transform's rotation.
public Vector3 localEulerAngles { get { return localRotation.eulerAngles; } set { localRotation = Quaternion.Euler(value); } }

Return to Quaternions.
Next, Quaternion.AngleAxis.