Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Rotator

An orthogonal rotation in 3d space

Hierarchy

  • Rotator

Implements

  • Iterable<number>

Index

Constructors

constructor

  • new Rotator(pitch: number, yaw: number, roll: number): Rotator
  • Make a rotator {Pitch, Yaw, Roll} from rotation values

    Parameters

    • pitch: number

      Rotation around Y axis in degrees

    • yaw: number

      Rotation around Z axis in degrees

    • roll: number

      Rotation around X axis in degrees

    Returns Rotator

Properties

0

0: number

Index for pitch

1

1: number

Index for yaw

2

2: number

Index for roll

pitch

pitch: number

Pitch (degrees) around Y axis

roll

roll: number

Roll (degrees) around X axis

yaw

yaw: number

Yaw (degrees) around Z axis

Methods

[Symbol.iterator]

  • [Symbol.iterator](): Iterator<number>

clone

compose

  • compose(b: Rotator | [pitch: number, yaw: number, roll: number]): Rotator
  • Combine 2 rotations to give the resulting rotation of first applying this rotator, then b

    Parameters

    • b: Rotator | [pitch: number, yaw: number, roll: number]

    Returns Rotator

equals

  • equals(b: Rotator | [pitch: number, yaw: number, roll: number], errorTolerance: number): boolean
  • Return true if this rotator is equal to rotator b (a == b) within a specified error tolerance

    Parameters

    • b: Rotator | [pitch: number, yaw: number, roll: number]

      Rotator to compare to

    • errorTolerance: number

      Maximum total difference

    Returns boolean

getForwardVector

getInverse

  • Return the inverse rotation that can reverse the rotation defined by this rotator. For rotations around multiple axis, this is not generally the same as the result from negate.

    Returns Rotator

getRightVector

getUpVector

multiply

  • Return rotator representing this rotation scaled by b

    Parameters

    • b: number

      Factor to multiply with

    Returns Rotator

negate

rotateVector

  • rotateVector(v: Vector | [x: number, y: number, z: number]): Vector
  • Return a vector rotated by this rotation

    Parameters

    • v: Vector | [x: number, y: number, z: number]

    Returns Vector

toString

  • toString(): string
  • Convert to a string in the form 'P= Y= R='

    Returns string

toVector

unrotateVector

  • unrotateVector(v: Vector | [x: number, y: number, z: number]): Vector
  • Return a vector rotated by the inverse of this rotation

    Parameters

    • v: Vector | [x: number, y: number, z: number]

    Returns Vector

Static fromAxisAngle

  • fromAxisAngle(axis: Vector | [x: number, y: number, z: number], angle: number): Rotator
  • Create a rotation from an axis and and angle

    Parameters

    • axis: Vector | [x: number, y: number, z: number]

      The axis to rotate around

    • angle: number

      The amount of rotation in degrees

    Returns Rotator

Static interpolateTo

  • interpolateTo(current: Rotator | [pitch: number, yaw: number, roll: number], target: Rotator | [pitch: number, yaw: number, roll: number], deltaTime: number, interpSpeed: number): Rotator
  • Smoothly interpolate towards a varying target rotation

    Parameters

    • current: Rotator | [pitch: number, yaw: number, roll: number]

      Current rotation

    • target: Rotator | [pitch: number, yaw: number, roll: number]

      Target rotation

    • deltaTime: number

      Time since last tick

    • interpSpeed: number

      Interpolation speed

    Returns Rotator

Static interpolateToConstant

  • interpolateToConstant(current: Rotator | [pitch: number, yaw: number, roll: number], target: Rotator | [pitch: number, yaw: number, roll: number], deltaTime: number, interpSpeed: number): Rotator
  • Smoothly interpolate towards a varying target rotation at a constant rate

    Parameters

    • current: Rotator | [pitch: number, yaw: number, roll: number]

      Current rotation

    • target: Rotator | [pitch: number, yaw: number, roll: number]

      Target rotation

    • deltaTime: number

      Time since last tick

    • interpSpeed: number

      Interpolation speed

    Returns Rotator

Static lerp

  • lerp(a: Rotator | [pitch: number, yaw: number, roll: number], b: Rotator | [pitch: number, yaw: number, roll: number], alpha: number, bShortestPath: boolean): Rotator
  • Linearly interpolate between a and b based on alpha

    Parameters

    • a: Rotator | [pitch: number, yaw: number, roll: number]

      First rotation

    • b: Rotator | [pitch: number, yaw: number, roll: number]

      Second rotation

    • alpha: number

      Result is 100% of a when alpha=0 and 100% of b when alpha=1

    • bShortestPath: boolean

    Returns Rotator