Options
All
• Public
• Public/Protected
• All

# Class Rotator

An orthogonal rotation in 3d space

• Rotator

### Implements

• Iterable<number>

## 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

## Properties

0: number

Index for pitch

1: number

Index for yaw

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

• Return a copy of this Rotator

### 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

### 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

### getForwardVector

• Return world forward vector rotated by this rotation

### 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.

### getRightVector

• Return world right vector rotated by this rotation

### getUpVector

• Return world up vector rotated by this rotation

### multiply

• Return rotator representing this rotation scaled by b

#### Parameters

• ##### b: number

Factor to multiply with

### negate

• Return negated rotator. For the inverse rotation, use getInverse.

### rotateVector

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

### toString

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

### toVector

• Get the X direction vector after this rotation

### unrotateVector

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

### 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

### 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

### 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

### 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