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

• Combine 2 rotations to give the resulting rotation of first applying this rotator, then b

### equals

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

#### Parameters

• ##### b: Rotator

Rotator to compare to

• ##### errorTolerance: number

Maximum total difference

### getForwardVector

• Return world forward vector rotated by this rotation

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

### rotateVector

• 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

• Return a vector rotated by the inverse of this rotation

### Static fromAxisAngle

• Create a rotation from an axis and and angle

#### Parameters

• ##### axis: Vector

The axis to rotate around

• ##### angle: number

The amount of rotation in degrees

### Static interpolateTo

• Smoothly interpolate towards a varying target rotation

#### Parameters

• ##### current: Rotator

Current rotation

• ##### target: Rotator

Target rotation

• ##### deltaTime: number

Time since last tick

• ##### interpSpeed: number

Interpolation speed

### Static interpolateToConstant

• interpolateToConstant(current: Rotator, target: Rotator, deltaTime: number, interpSpeed: number): Rotator
• Smoothly interpolate towards a varying target rotation at a constant rate

#### Parameters

• ##### current: Rotator

Current rotation

• ##### target: Rotator

Target rotation

• ##### deltaTime: number

Time since last tick

• ##### interpSpeed: number

Interpolation speed

### Static lerp

• Linearly interpolate between a and b based on alpha

#### Parameters

• ##### a: Rotator

First rotation

• ##### b: Rotator

Second rotation

• ##### alpha: number

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