Cluster Creator Kit Script Reference
    Preparing search index...

    Class Quaternion

    A quaternion.

    Methods that manipulate values are generally destructive. To preserve the original values, explicitly call clone() to create a duplicate instance.

    Index

    Constructors

    Properties

    w: number
    x: number
    y: number
    z: number

    Methods

    • Returns a value that represents the current rotation in Euler angles.

      Returns Vector3

    • Returns the dot product of the quaternion and v.

      Parameters

      Returns number

    • Compares the quaternion to v, and returns true if they are approximately equal.

      Parameters

      Returns boolean

    • Updates the quaternion's value to the identity rotation. This is the state of having no rotation.

      Returns this

    • Inverts the quaternion's value.

      Returns this

    • Returns the quaternion's length when viewed as a 4-dimensional vector.

      Returns number

    • Returns the quaternion's squared length when viewed as a 4-dimensional vector.

      Returns number

    • Multiplies the quaternion's value by v.

      Parameters

      Returns this

    • Normalizes the quaternion's value.

      Returns this

    • Sets the quaternion's component values to those specified in x, y, z, and w.

      Parameters

      • x: number
      • y: number
      • z: number
      • w: number

      Returns this

    • Updates the quaternion to a value that represents a rotation of degree degrees around the axis.

      Parameters

      Returns this

      new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), 90);
      
    • Updates the quaternion to a value that represents a rotation in Euler angles. Axes are applied in the order of ZXY.

      Parameters

      Returns this

      new Quaternion().setFromEulerAngles(new Vector3(90, 0, 0));
      
    • Updates the quaternion to a value that represents a rotation in Euler angles. Axes are applied in the order of ZXY.

      Parameters

      • x: number
      • y: number
      • z: number

      Returns this

      new Quaternion().setFromEulerAngles(90, 0, 0);
      
    • Calculates the spherical linear interpolation (slerp) between the current value and v, using a as the interpolation factor, then updates the quaternion's value to the result.

      Parameters

      • v: Quaternion
      • a: number

        The interpolation factor, specified as a number between [0, 1].

      Returns this

      let min = new Quaternion().identity();
      let max = new Quaternion().setFromEulerAngles(0, 45, 0);
      min.clone().slerp(max, 0.5);
    • Gets the axis and angle values that represent the current rotation.

      Returns AxisAngle

    Static Methods

    • Gets the quaternion that represents a rotation of degree degrees around the axis.

      Parameters

      Returns Quaternion

      let q = Quaternion.axisAngle(new Vector3(0, 1, 0), 90);
      
    • Gets the quaternion by the value that represents a rotation in Euler angles. Axes are applied in the order of ZXY.

      Parameters

      Returns Quaternion

    • Gets the quaternion by the value that represents a rotation in Euler angles. Axes are applied in the order of ZXY.

      Parameters

      • x: number
      • y: number
      • z: number

      Returns Quaternion

    • Creates a Quaternion looking towards forward direction with the upward direction being up.

      up is optional, and if omitted, it will be treated as if new Vector3(0, 1, 0) was specified.

      Parameters

      Returns Quaternion