Angle
Angle
List of all possible functions to manipulate angles.
Created by Angle.
Type | Name | Description |
---|---|---|
number | p or pitch or x or 1 |
The pitch component of the angle. |
number | y or yaw or 2 |
The yaw component of the angle. |
number | r or roll or z or 3 |
The roll component of the angle. |
Metamethod | Second Operand | Description |
---|---|---|
__add |
Angle | Returns new Angle with the result of addition. |
__div |
number | Returns new Angle with the result of division. |
__eq |
any | Compares 2 operands, if they both are Angle, compares each individual component. Doesn't normalize the angles (360 is not equal to 0). |
__index |
number or string | Gets the component of the Angle. Returns a number. |
__mul |
number | Returns new Angle with the result of multiplication. |
__newindex |
number or string | Sets the component of the Angle. Accepts number and string. |
__sub |
Angle | Returns new Angle with the result of subtraction. |
__tostring |
Returns p y r . |
|
__unm |
Returns new Angle with the result of negation. |
Methods
Adds the values of the argument angle to the orignal angle.
This functions the same as angle1 + angle2 without creating a new angle object, skipping object construction and garbage collection.
Divides all values of the original angle by a scalar. This functions the same as angle1 / num without creating a new angle object, skipping object construction and garbage collection.
Returns if the angle is equal to another angle with the given tolerance.
Multiplies a scalar to all the values of the orignal angle. This functions the same as num * angle without creating a new angle object, skipping object construction and garbage collection.
Angle:Normalize()
Normalizes the angles by applying a module with 360 to pitch, yaw and roll.
Returns a normal vector facing in the direction that points right relative to the angle's direction.
Rotates the angle around the specified axis by the specified degrees.
Sets the p, y, and r of the angle.
Snaps the angle to nearest interval of degrees.
Note: This will modify the original angle too!
Subtracts the values of the argument angle to the orignal angle. This functions the same as angle1 - angle2 without creating a new angle object, skipping object construction and garbage collection.
Returns a normal vector facing in the direction that points up relative to the angle's direction.
Angle:Zero()
Sets pitch, yaw and roll to 0.
This function is faster than doing it manually.
Example: Shorthand Angular Index
Indexing by angular single-character component.
Output: 1 2 3
Example: Named Angular Index
Indexing by angular named component.
Output: 1 2 3
Example: Vector Index
Indexing by vector single-character component.
Output: 1 2 3