Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Quaternion

Index

Constructors

  • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion
  • Creates a new Quaternion from the given floats

    Parameters

    • Optional x: number

      defines the first component (0 by default)

    • Optional y: number

      defines the second component (0 by default)

    • Optional z: number

      defines the third component (0 by default)

    • Optional w: number

      defines the fourth component (1.0 by default)

    Returns Quaternion

Accessors

  • get w(): number
  • set w(value: number): void
  • Gets or sets the w coordinate

    Returns number

  • Gets or sets the w coordinate

    Parameters

    • value: number

    Returns void

  • get x(): number
  • set x(value: number): void
  • Gets or sets the x coordinate

    Returns number

  • Gets or sets the x coordinate

    Parameters

    • value: number

    Returns void

  • get y(): number
  • set y(value: number): void
  • Gets or sets the y coordinate

    Returns number

  • Gets or sets the y coordinate

    Parameters

    • value: number

    Returns void

  • get z(): number
  • set z(value: number): void
  • Gets or sets the z coordinate

    Returns number

  • Gets or sets the z coordinate

    Parameters

    • value: number

    Returns void

Methods

  • asArray(): number[]
  • Copy the quaternion to an array Example Playground https://playground.babylonjs.com/#L49EJ7#13

    Returns number[]

    a new array populated with 4 elements from the quaternion coordinates

  • conjugateToRef<T>(ref: T): T
  • Conjugates the current quaternion and stores the result in the given quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#81

    Type Parameters

    Parameters

    • ref: T

      defines the target quaternion

    Returns T

    result input

  • copyFromFloats(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion with the given float coordinates Example Playground https://playground.babylonjs.com/#L49EJ7#87

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

  • Gets a boolean if two quaternions are equals (using an epsilon value) Example Playground https://playground.babylonjs.com/#L49EJ7#37

    Parameters

    • otherQuaternion: DeepImmutableObject<Quaternion>

      defines the other quaternion

    • Optional epsilon: number

      defines the minimal distance to consider equality

    Returns boolean

    true if the given quaternion coordinates are close to the current ones by a distance of epsilon.

  • getClassName(): string
  • Gets the class name of the quaternion

    Returns string

    the string "Quaternion"

  • getHashCode(): number
  • Gets a hash code for this quaternion

    Returns number

    the quaternion hash code

  • length(): number
  • lengthSquared(): number
  • Multiplies the current quaternion by a scale factor Example Playground https://playground.babylonjs.com/#L49EJ7#88

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    a new quaternion set by multiplying the current quaternion coordinates by the float "scale"

  • scaleAndAddToRef<T>(scale: number, result: T): T
  • Scale the current quaternion values by a factor and add the result to a given quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#91

    Type Parameters

    Parameters

    • scale: number

      defines the scale factor

    • result: T

      defines the Quaternion object where to store the result

    Returns T

    result input

  • Multiplies in place the current quaternion by a scale factor Example Playground https://playground.babylonjs.com/#L49EJ7#90

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    the current modified quaternion

  • scaleToRef<T>(scale: number, result: T): T
  • Scale the current quaternion values by a factor and stores the result to a given quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#89

    Type Parameters

    Parameters

    • scale: number

      defines the scale factor

    • result: T

      defines the Quaternion object where to store the result

    Returns T

    result input

  • set(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion from the given float coordinates Example Playground https://playground.babylonjs.com/#L49EJ7#56

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

  • Stores from the starting index in the given array the Quaternion successive values Example Playground https://playground.babylonjs.com/#L49EJ7#59

    Parameters

    • array: FloatArray

      defines the array where to store the x,y,z,w components

    • Optional index: number

      defines an optional index in the target array to define where to start storing values

    Returns Quaternion

    the current Quaternion object

  • toEulerAnglesToRef<T>(result: T): T
  • toRotationMatrix<T>(result: T): T
  • Updates the given rotation matrix with the current quaternion values Example Playground https://playground.babylonjs.com/#L49EJ7#67

    Type Parameters

    Parameters

    • result: T

      defines the target matrix

    Returns T

    the updated matrix with the rotation

  • toString(): string
  • Gets a string representation for the current quaternion

    Returns string

    a string with the Quaternion coordinates

  • Checks if the orientations of two rotation quaternions are close to each other Example Playground https://playground.babylonjs.com/#L49EJ7#60

    Parameters

    Returns boolean

    true if the two quaternions are close to each other within epsilon

  • Creates a new quaternion from data stored into an array Example Playground https://playground.babylonjs.com/#L49EJ7#63

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      defines the data source

    • Optional offset: number

      defines the offset in the source array where the data starts

    Returns Quaternion

    a new quaternion

  • Updates the given quaternion "result" from the starting index of the given array. Example Playground https://playground.babylonjs.com/#L49EJ7#64

    Type Parameters

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      the array to pull values from

    • offset: number

      the offset into the array to start at

    • result: T

      the quaternion to store the result in

    Returns T

    result input

  • FromEulerAngles(x: number, y: number, z: number): Quaternion
  • FromEulerAnglesToRef<T>(x: number, y: number, z: number, result: T): T
  • Updates a quaternion from Euler rotation angles Example Playground https://playground.babylonjs.com/#L49EJ7#34

    Type Parameters

    Parameters

    • x: number

      Pitch

    • y: number

      Yaw

    • z: number

      Roll

    • result: T

      the quaternion to store the result

    Returns T

    the updated quaternion

  • Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like "up". This function works in left handed mode Example Playground https://playground.babylonjs.com/#L49EJ7#96

    Parameters

    Returns Quaternion

    A new quaternion oriented toward the specified forward and up.

  • Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like "up", and stores it in the target quaternion. This function works in left handed mode Example Playground https://playground.babylonjs.com/#L49EJ7#97

    Type Parameters

    Parameters

    • forward: DeepImmutableObject<Vector3>

      defines the forward direction - Must be normalized and orthogonal to up.

    • up: DeepImmutableObject<Vector3>

      defines the up vector for the entity - Must be normalized and orthogonal to forward.

    • ref: T

      defines the target quaternion.

    Returns T

    result input

  • Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like "up". This function works in right handed mode Example Playground https://playground.babylonjs.com/#L49EJ7#98

    Parameters

    Returns Quaternion

    A new quaternion oriented toward the specified forward and up.

  • Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like "up", and stores it in the target quaternion. This function works in right handed mode Example Playground https://playground.babylonjs.com/#L49EJ7#105

    Type Parameters

    Parameters

    • forward: DeepImmutableObject<Vector3>

      defines the forward direction - Must be normalized and orthogonal to up.

    • up: DeepImmutableObject<Vector3>

      defines the up vector for the entity - Must be normalized and orthogonal to forward.

    • ref: T

      defines the target quaternion.

    Returns T

    result input

  • Updates a quaternion so that it rotates vector vecFrom to vector vecTo Example Playground - https://playground.babylonjs.com/#L49EJ7#70

    Type Parameters

    Parameters

    • vecFrom: DeepImmutableObject<Vector3>

      defines the direction vector from which to rotate

    • vecTo: DeepImmutableObject<Vector3>

      defines the direction vector to which to rotate

    • result: T

      the quaternion to store the result

    • Optional epsilon: number

      defines the minimal dot value to define vecs as opposite. Default: BABYLON.Epsilon

    Returns T

    the updated quaternion

  • Creates an identity quaternion

    Returns Quaternion

    the identity quaternion

  • Gets a boolean indicating if the given quaternion is identity

    Parameters

    Returns boolean

    true if the quaternion is identity

  • RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation Example Playground https://playground.babylonjs.com/#L49EJ7#68

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    Returns Quaternion

    the new quaternion

  • RotationAlphaBetaGammaToRef<T>(alpha: number, beta: number, gamma: number, result: T): T
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#69

    Type Parameters

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    • result: T

      defines the target quaternion

    Returns T

    result input

  • Creates a rotation around an axis and stores it into the given quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#73

    Type Parameters

    Parameters

    • axis: DeepImmutableObject<Vector3>

      defines the axis to use

    • angle: number

      defines the angle to use

    • result: T

      defines the target quaternion

    Returns T

    the target quaternion

  • RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion
  • Creates a new quaternion from the given Euler float angles (y, x, z) Example Playground https://playground.babylonjs.com/#L49EJ7#77

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    Returns Quaternion

    the new quaternion

  • RotationYawPitchRollToRef<T>(yaw: number, pitch: number, roll: number, result: T): T
  • Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion Example Playground https://playground.babylonjs.com/#L49EJ7#78

    Type Parameters

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    • result: T

      defines the target quaternion

    Returns T

    result input

  • SmoothToRef<T>(source: Quaternion, goal: Quaternion, deltaTime: number, lerpTime: number, result: T): T
  • Smooth interpolation between two quaternions using Slerp Example Playground https://playground.babylonjs.com/#L49EJ7#93

    Type Parameters

    Parameters

    • source: Quaternion

      source quaternion

    • goal: Quaternion

      goal quaternion

    • deltaTime: number

      current interpolation frame

    • lerpTime: number

      total interpolation time

    • result: T

      the smoothed quaternion

    Returns T

  • Creates an empty quaternion

    Returns Quaternion

    a new quaternion set to (0.0, 0.0, 0.0)

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme