![]() |
GearBlocks
The GearBlocks Lua scripting API
|
A 3D vector. More...
Public Member Functions | |
Vector3Proxy (float x, float y, float z) | |
Constructor. | |
void | Normalize () |
Normalise this vector to a magnitude of 1. | |
void | Set (float newX, float newY, float newZ) |
Set the components of this vector. | |
Static Public Member Functions | |
static Vector3Proxy | Normalize (Vector3Proxy a) |
Normalise a vector to a magnitude of 1. | |
static Vector3Proxy | ClampMagnitude (Vector3Proxy a, float maxLength) |
Get the vector with a clamped magnitude. | |
static Vector3Proxy | Min (Vector3Proxy a, Vector3Proxy b) |
Get the component-wise minimum of two vectors. | |
static Vector3Proxy | Max (Vector3Proxy a, Vector3Proxy b) |
Get the component-wise maximum of two vectors. | |
static Vector3Proxy | Scale (Vector3Proxy a, Vector3Proxy b) |
Get the component-wise multiplication of two vectors. | |
static float | Distance (Vector3Proxy a, Vector3Proxy b) |
Get the distance between two point vectors. | |
static float | Angle (Vector3Proxy a, Vector3Proxy b) |
Get the angle between two direction vectors. | |
static float | SignedAngle (Vector3Proxy a, Vector3Proxy b, Vector3Proxy axis) |
Get the signed angle between two direction vectors in relation to an axis vector. | |
static float | Dot (Vector3Proxy a, Vector3Proxy b) |
Get the dot product between two vectors. | |
static Vector3Proxy | Cross (Vector3Proxy a, Vector3Proxy b) |
Get the cross product between two vectors. | |
static Vector3Proxy | Project (Vector3Proxy a, Vector3Proxy normal) |
Project one vector onto another. | |
static Vector3Proxy | ProjectOnPlane (Vector3Proxy a, Vector3Proxy planeNormal) |
Project a vector onto a plane. | |
static Vector3Proxy | Reflect (Vector3Proxy a, Vector3Proxy planeNormal) |
Reflect a direction vector off a plane. | |
static Vector3Proxy | Lerp (Vector3Proxy a, Vector3Proxy b, float t) |
Linearly interpolate between two point vectors by t (clamping t to [0, 1]). | |
static Vector3Proxy | LerpUnclamped (Vector3Proxy a, Vector3Proxy b, float t) |
Linearly interpolate between two point vectors by t (not clamping t). | |
static Vector3Proxy | Slerp (Vector3Proxy a, Vector3Proxy b, float t) |
Spherically interpolate between two direction vectors by t (clamping t to [0, 1]). | |
static Vector3Proxy | SlerpUnclamped (Vector3Proxy a, Vector3Proxy b, float t) |
Spherically interpolate between two direction vectors by t (not clamping t). | |
static Vector3Proxy | MoveTowards (Vector3Proxy fromPoint, Vector3Proxy toPoint, float step) |
Create a point vector moved from "fromPoint" towards "toPoint". | |
static Vector3Proxy | RotateTowards (Vector3Proxy fromDirection, Vector3Proxy toDirection, float angleStep, float magStep) |
Create a direction vector rotated from "fromDirection" towards "toDirection". | |
static Vector3Proxy | Abs (Vector3Proxy vec) |
Get the component-wise absolute of a vector. | |
static Vector3Proxy | Mod (Vector3Proxy vec, float divisor) |
Get the component-wise modulus of a vector. | |
static Vector3Proxy | Clamp (Vector3Proxy vec, Vector3Proxy min, Vector3Proxy max) |
Get the vector clamped component-wise. | |
static Vector3Proxy | Clamp01 (Vector3Proxy vec) |
Get the vector clamped component-wise between zero and one. | |
static Vector3Proxy | Round (Vector3Proxy vec) |
Get the vector rounded component-wise. | |
static Vector3Proxy | Round (Vector3Proxy vec, float roundTo) |
Get the vector rounded component-wise. | |
static Vector3Proxy | Round (Vector3Proxy vec, float roundTo, Vector3Proxy offset) |
Get the vector rounded component-wise. | |
static Vector3Proxy | Round (Vector3Proxy vec, Vector3Proxy roundTo) |
Get the vector rounded component-wise. | |
static Vector3Proxy | Round (Vector3Proxy vec, Vector3Proxy roundTo, Vector3Proxy offset) |
Get the vector rounded component-wise. | |
static Vector3Proxy | Wrap (Vector3Proxy vec, float minWrapTo, float maxWrapTo) |
Get the vector wrapped component-wise. | |
static Vector3Proxy | Wrap (Vector3Proxy vec, Vector3Proxy minWrapTo, Vector3Proxy maxWrapTo) |
Get the vector wrapped component-wise. | |
static Vector3Proxy | operator+ (Vector3Proxy a, Vector3Proxy b) |
Add two vectors. | |
static Vector3Proxy | operator- (Vector3Proxy a) |
Negate a vector. | |
static Vector3Proxy | operator- (Vector3Proxy a, Vector3Proxy b) |
Subract two vectors. | |
static Vector3Proxy | operator* (Vector3Proxy a, float d) |
Multiply a vector by a scalar. | |
static Vector3Proxy | operator* (float d, Vector3Proxy a) |
Multiply a vector by a scalar. | |
static Vector3Proxy | operator/ (Vector3Proxy a, float d) |
Divide a vector by a scalar. | |
static bool | operator== (Vector3Proxy a, Vector3Proxy b) |
Compare two vectors. | |
static bool | operator!= (Vector3Proxy a, Vector3Proxy b) |
Compare two vectors. | |
Properties | |
float | X [get, set] |
The vector's x component. | |
float | Y [get, set] |
The vector's y component. | |
float | Z [get, set] |
The vector's z component. | |
float | this[int index] [get, set] |
The vector component at the specified index. | |
static Vector3Proxy | One [get] |
The one vector. | |
static Vector3Proxy | Zero [get] |
The zero vector. | |
static Vector3Proxy | Up [get] |
The up vector. | |
static Vector3Proxy | Down [get] |
The down vector. | |
static Vector3Proxy | Right [get] |
The right vector. | |
static Vector3Proxy | Left [get] |
The left vector. | |
static Vector3Proxy | Forward [get] |
The forward vector. | |
static Vector3Proxy | Back [get] |
The back vector. | |
float | SqrMagnitude [get] |
The vector's square magnitude. | |
Vector3Proxy | Normalized [get] |
The normalised vector. | |
float | Magnitude [get] |
The vector's magnitude. | |
A 3D vector.
Static methods available in Lua via the "Vector3" global, for example:
SmashHammer.Scripting.Vector3Proxy.Vector3Proxy | ( | float | x, |
float | y, | ||
float | z | ||
) |
Constructor.
x | The x component to initialise with. |
y | The y component to initialise with. |
z | The z component to initialise with. |
|
static |
Normalise a vector to a magnitude of 1.
a | The vector to normalise. |
|
static |
Get the vector with a clamped magnitude.
a | The vector to clamp. |
maxLength | The value to clamp the magnitude by. |
|
static |
Get the component-wise minimum of two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Get the component-wise maximum of two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Get the component-wise multiplication of two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Get the distance between two point vectors.
a | The first vector. |
b | The second vector. |
|
static |
Get the angle between two direction vectors.
a | The "from" vector. |
b | The "to" vector. |
|
static |
Get the signed angle between two direction vectors in relation to an axis vector.
a | The "from" vector. |
b | The "to" vector. |
axis | The rotation axis. |
|
static |
Get the dot product between two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Get the cross product between two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Project one vector onto another.
a | The vector to project. |
normal | The vector to project on to. |
|
static |
Project a vector onto a plane.
a | The vector to project. |
planeNormal | The plane normal. |
|
static |
Reflect a direction vector off a plane.
a | The vector to reflect. |
planeNormal | The plane normal. |
|
static |
Linearly interpolate between two point vectors by t (clamping t to [0, 1]).
a | The first vector. |
b | The second vector. |
t | The interpolation amount. |
|
static |
Linearly interpolate between two point vectors by t (not clamping t).
a | The first vector. |
b | The second vector. |
t | The interpolation amount. |
|
static |
Spherically interpolate between two direction vectors by t (clamping t to [0, 1]).
a | The first vector. |
b | The second vector. |
t | The interpolation amount. |
|
static |
Spherically interpolate between two direction vectors by t (not clamping t).
a | The first vector. |
b | The second vector. |
t | The interpolation amount. |
|
static |
Create a point vector moved from "fromPoint" towards "toPoint".
fromPoint | Move from. |
toPoint | Move to. |
step | Distance to move by. |
|
static |
Create a direction vector rotated from "fromDirection" towards "toDirection".
fromDirection | Rotate from. |
toDirection | Rotate to. |
angleStep | Angular step to rotate by. |
magStep | Magnitude step to change by. |
|
static |
Get the component-wise absolute of a vector.
vec | The vector. |
|
static |
Get the component-wise modulus of a vector.
vec | The vector. |
divisor | The divisor for the modulus. |
|
static |
Get the vector clamped component-wise.
vec | The vector. |
min | Minimum components to clamp to. |
max | Maximum components to clamp to. |
|
static |
Get the vector clamped component-wise between zero and one.
vec | The vector. |
|
static |
Get the vector rounded component-wise.
vec | The vector. |
|
static |
Get the vector rounded component-wise.
vec | The vector. |
roundTo | Value to round the components to. |
|
static |
Get the vector rounded component-wise.
vec | The vector. |
roundTo | Value to round the components to. |
offset | Amount to offset the rounding by. |
|
static |
Get the vector rounded component-wise.
vec | The vector. |
roundTo | Components to round to. |
|
static |
Get the vector rounded component-wise.
vec | The vector. |
roundTo | Components to round to. |
offset | Amount to offset the rounding by. |
|
static |
Get the vector wrapped component-wise.
vec | The vector. |
minWrapTo | Min value to wrap the components to. |
maxWrapTo | Max value to wrap the components to. |
|
static |
Get the vector wrapped component-wise.
vec | The vector. |
minWrapTo | Min components to wrap to. |
maxWrapTo | Max components to wrap to. |
|
static |
Add two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Negate a vector.
a | The vector. |
|
static |
Subract two vectors.
a | The first vector. |
b | The second vector. |
|
static |
Multiply a vector by a scalar.
a | The vector. |
d | The scalar value. |
|
static |
Multiply a vector by a scalar.
d | The scalar value. |
a | The vector. |
|
static |
Divide a vector by a scalar.
a | The vector. |
d | The scalar value. |
|
static |
Compare two vectors.
a | The first vector. |
b | The second vector. |
true
if the vectors are equal; otherwise, false
.
|
static |
Compare two vectors.
a | The first vector. |
b | The second vector. |
true
if the vectors are not equal; otherwise, false
.void SmashHammer.Scripting.Vector3Proxy.Set | ( | float | newX, |
float | newY, | ||
float | newZ | ||
) |
Set the components of this vector.
newX | The x component of the vector. |
newY | The y component of the vector. |
newZ | The z component of the vector. |
|
getset |
The vector's x component.
The x component of this vector.
|
getset |
The vector's y component.
The y component of this vector.
|
getset |
The vector's z component.
The z component of this vector.
|
getset |
The vector component at the specified index.
index | The component index:-
|
The vector component.
|
staticget |
The one vector.
A new vector with all components initialised to one.
|
staticget |
The zero vector.
A new vector with all components initialised to zero.
|
staticget |
The up vector.
A new vector initialised to (0, 1, 0).
|
staticget |
The down vector.
A new vector initialised to (0, -1, 0).
|
staticget |
The right vector.
A new vector initialised to (1, 0, 0).
|
staticget |
The left vector.
A new vector initialised to (-1, 0, 0).
|
staticget |
The forward vector.
A new vector initialised to (0, 0, 1).
|
staticget |
The back vector.
A new vector initialised to (0, 0, -1).
|
get |
The vector's square magnitude.
The squared magnitude of this vector.
|
get |
The normalised vector.
This vector normalised to a magnitude of 1.
|
get |
The vector's magnitude.
The magnitude of this vector.