Passer au contenu principal
Version: bleeding-edge 🩸

🧭 Rotator

A container for rotation information (Pitch, Yaw, Roll). All rotation values are stored in degrees.

🧑‍💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

info

Les Rotator sont compressés en interne et automatiquement, ce qui réduit leur taille dans le réseau jusqu'à 90 %. Leurs composants sont généralement compressés en 1 octets chacun (à quelques exceptions où nous avons besoin de plus de précision).

🎒 Examples​

``local new_rotator = Rotator(-90, 153, 24.5)``

🛠 Constructors​

Default Constructor

``local my_rotator = Rotator(pitch?, yaw?, roll?)``
TypeNameDefaultDescription
number`pitch``0`Pitch
number`yaw``pitch`Yaw
number`roll``pitch`Roll

🧽 Properties​

TypeNameDescription
number`Pitch`Rotation around the right axis (around Y axis), Looking up and down (0=Straight Ahead, +Up, -Down)
number`Yaw`Rotation around the up axis (around Z axis), Running in circles 0=East, +North, -South.
number`Roll`Rotation around the forward axis (around X axis), Tilting your head, 0=Straight, +Clockwise, -CCW.

🦠 Functions​

info

This structure supports `+`, `-`, `*` and `tostring` operations.

ReturnsNameDescription
Vector`GetForwardVector`Get the forward (X) unit direction vector from this component, in world space.
Vector`GetRightVector`Get the right (Y) unit direction vector from this component, in world space.
Vector`GetUpVector`Get the up (Z) unit direction vector from this component, in world space.
Vector`RotateVector`Rotate a vector rotated by this rotator.
`Normalize`In-place normalize, removes all winding and creates the “shortest route” rotation.
Vector`UnrotateVector`Returns the vector rotated by the inverse of this rotator.
Quat`Quaternion`Get Rotation as a quaternion.
Rotator`GetNormalized`Returns a new Rotator normalized.
boolean`IsNearlyZero`Checks whether rotator is near to zero within a specified tolerance
boolean`IsZero`Checks whether all components of the rotator are exactly zero

`GetForwardVector`

Get the forward (X) unit direction vector from this component, in world space.

— Returns Vector (the forward direction).

``local ret = my_rotator:GetForwardVector()``

`GetRightVector`

Get the right (Y) unit direction vector from this component, in world space.

— Returns Vector (the right direction).

``local ret = my_rotator:GetRightVector()``

`GetUpVector`

Get the up (Z) unit direction vector from this component, in world space.

— Returns Vector (the up direction).

``local ret = my_rotator:GetUpVector()``

`RotateVector`

Rotate a vector rotated by this rotator.

— Returns Vector (the rotated vector).

``local ret = my_rotator:RotateVector(vector)``
TypeParameterDefaultDescription
Vector`vector` Required parameter the vector to rotate by the Rotator

`Normalize`

In-place normalize, removes all winding and creates the “shortest route” rotation.

``my_rotator:Normalize()``

`UnrotateVector`

Returns the vector rotated by the inverse of this rotator.

— Returns Vector (the unrotated vector).

``local ret = my_rotator:UnrotateVector(vector)``
TypeParameterDefaultDescription
Vector`vector` Required parameter The vector to rotate by the inverse of the Rotator

`Quaternion`

Get Rotation as a quaternion.

— Returns Quat (the rotation as a quaternion).

``local ret = my_rotator:Quaternion()``

`GetNormalized`

Returns a new Rotator normalized.

— Returns Rotator (the normalized Rotator).

``local ret = my_rotator:GetNormalized()``

`IsNearlyZero`

Checks whether rotator is near to zero within a specified tolerance

— Returns boolean (whether the rotator is nearly zero).

``local ret = my_rotator:IsNearlyZero(tolerance?)``
TypeParameterDefaultDescription
number`tolerance?``0.000001`Tolerance to check

`IsZero`

Checks whether all components of the rotator are exactly zero

— Returns boolean (whether the rotator is exactly zero).

``local ret = my_rotator:IsZero()``

🗿 Static Functions​

ReturnsNameDescription
Rotator`Random`Generates a random rotation, with optional random roll

`Random`

Generates a random rotation, with optional random roll

— Returns Rotator (the random rotation).

``local ret = Rotator.Random(roll?, min?, max?)``
TypeParameterDefaultDescription
boolean`roll?``false`Whether to use a random roll in the rotator, otherwise uses 0 for roll
float`min?``-180`Minimum value
float`max?``180`Maximum value