Skip to content

Angle

The Angle class represents a 3D angle.


Properties

pitchnumber

The pitch component of the angle.


yawnumber

The yaw component of the angle.


rollnumber

The roll component of the angle.


Accessors

xnumber

Gets the pitch component of the angle.

  • Getter - Gets the pitch component of the angle.
  • Setter - Sets the pitch component of the angle.

ynumber

Gets the yaw component of the angle.

  • Getter - Gets the yaw component of the angle.
  • Setter - Sets the yaw component of the angle.

znumber

Gets the roll component of the angle.

  • Getter - Gets the roll component of the angle.
  • Setter - Sets the roll component of the angle.

Methods

constructor(pitch?: number, yaw?: number, roll?: number)

Creates a new Angle instance.

  • pitchnumber (optional) - The pitch component of the angle. Defaults to 0.
  • yawnumber (optional) - The yaw component of the angle. Defaults to 0.
  • rollnumber (optional) - The roll component of the angle. Defaults to 0.

GetForward()Vector

Returns a forward-facing vector from this angle.

Returned:

  • Vector - A forward-facing vector from this angle.

add(other: Angle)Angle

Adds another angle to this angle.

  • otherAngle - The angle to add.

Returned:

  • Angle - A new angle that is the result of the addition.

sub(other: Angle)Angle

Subtracts another angle from this angle.

  • otherAngle - The angle to subtract.

Returned:

  • Angle - A new angle that is the result of the subtraction.

toString()string

Returns a string representation of the angle.

Returned:

  • string - A string representation of the angle.