Available since Version 1.0.
The Engine.Vector3 table provides functions for working with 3D vectors.
Variables
| Variable Name | Description |
|---|---|
Engine.Vector3.zero |
A vector with all components equal to 0 (0, 0, 0). |
Engine.Vector3.one |
A vector with all components equal to 1 (1, 1, 1). |
Engine.Vector3.up |
A vector representing the up direction (0, 1, 0). |
Engine.Vector3.down |
A vector representing the down direction (0, -1, 0). |
Engine.Vector3.left |
A vector representing the left direction (-1, 0, 0). |
Engine.Vector3.right |
A vector representing the right direction (1, 0, 0). |
Engine.Vector3.forward |
A vector representing the forward direction (0, 0, 1). |
Engine.Vector3.backward |
A vector representing the backward direction (0, 0, -1). |
Methods
| Function Name | Description |
|---|---|
| Engine.Vector3.create | Creates a vector from the specified components (x, y, z). |
| Engine.Vector3.Set | Sets the components of an existing vector. |
| Engine.Vector3.Add | Adds two vectors together and returns the result. |
| Engine.Vector3.Distance | Calculates the distance between two vectors. |
| Engine.Vector3.Angle | Calculates the angle between two vectors in degrees. |
| Engine.Vector3.ClampMagnitude | Clamps the magnitude of a vector to a specified maximum. |
| Engine.Vector3.Cross | Calculates the cross product of two vectors. |
| Engine.Vector3.Dot | Calculates the dot product of two vectors. |
| Engine.Vector3.Lerp | Linearly interpolates between two vectors by a specified amount. |
| Engine.Vector3.LerpUnclamped | Linearly interpolates between two vectors by a specified amount without clamping. |
| Engine.Vector3.Max | Returns a vector that is made from the largest components of two vectors. |
| Engine.Vector3.Min | Returns a vector that is made from the smallest components of two vectors. |
| Engine.Vector3.Normalize | Returns a vector with the same direction as the original but with a magnitude of 1. |
Metatable
| Metamethod Name | Description |
|---|---|
__call |
Alias for Engine.Vector3.create. |