-
Notifications
You must be signed in to change notification settings - Fork 0
Vector3
Jesusemora edited this page Mar 30, 2023
·
4 revisions
float pos[3] |
naked array containing the values of Vector3 |
float &x |
reference to the first element of pos[]. can be used as myVector3.x. |
float &y |
reference to the second element of pos[]. can be used as myVector3.y. |
float &z |
reference to the third element of pos[]. can be used as myVector3.z. |
float Magnitude() |
returns non sqr magnitude of current Vector3
|
float sqrMagnitude() |
returns sqr magnitude of current Vector3
|
void Normalize() |
normalizes current Vector3
|
Vector3 normalized |
returns the normalized version of current Vector3
|
Vector3 up, down, left, right, forward, back, zero
| Variable | x | y | z |
|---|---|---|---|
Vector3 up |
0 | 1 | 0 |
Vector3 down |
0 | -1 | 0 |
Vector3 left |
-1 | 0 | 0 |
Vector3 right |
1 | 0 | 0 |
Vector3 forward |
0 | 0 | 1 |
Vector3 back |
0 | 0 | -1 |
Vector3 zero |
0 | 0 | 0 |
use these to quickly obtain a "vector" in a given direction, or a Vector3 filled with 0
float fastDistance(Vector3 a, Vector3 b) |
returns the distance between a and b in a tiled space ( like chess ) |
float Distance(Vector3 a, Vector3 b) |
returns the exact distance between a and b |
float Dot(Vector3 a, Vector3 b) |
returns the dot product of a and b |
Vector3 Cross(Vector3 a, Vector3 b) |
returns the cross product of a and b |
Vector3 Lerp(Vector3 a, Vector3 b) |
returns the middle point between a and b, equivalent to glsl mix(a, b, 0.5) or cg lerp(a, b, 0.5)
|
Vector3 Lerp(Vector3 a, Vector3 b, float c |
returns the point c between a and b, equivalent to glsl mix(a, b, c) or cg lerp(a, b, c)
|
Vector3 Slerp(Vector3 a, Vector3 b, float c |
smooth interpolation between a and b given c. |
Vector3(float x, float y, float z) |
generates a Vector3 containing the values x, y and z. |
Vector3 |
generates a Vector3 filled with 0 wihout parameters |
Vector3(const Vector3 &vec) |
generates a Vector3 from another Vector3. |
operator+ adds two Vector3s
operator- substracts two Vector3s
operator+= adds the values of Vector3 to current
operator-= substracts the values of Vector3 from current
operator* multiplies current Vector3 by a float
operator/ divides current Vector3 by a float
operator+ adds float to every value of current Vector3
operator- substracts float from every value of current Vector3
operator*= multiplies every value of current Vector3 by float
operator/= divides every value of current Vector3 by float
operator== returns true if two Vector3s are equal and false if they are different
operator= assigns the values of Vector3 or the x and y values of Vector2 to Vector3