Vector¶
Used to represent several different values in the 3D world. For example, a 3D coordinate, direction, velocity, or a surface normal direction. Supports the following operators: +
, -
, *
, ==
.
Variables¶
- x (float)
- Coordinate or magnitude on the x axis. Positive x points east on the world map and negative x points west.
- y (float)
- Coordinate or magnitude on the y axis. Positive y points directly up in the game world while negative y points directly down.
- z (float)
- Coordinate or magnitude on the z axis. Positive z points north on the world map and negative z points south.
Functions¶
- new (Vector CopyVector)
- Creates a new vector and sets it’s values to the values of
CopyVector
. - new (float InitialValue)
- Creates a new vector and sets it’s values to
InitialValue
. - new (float x, float y, float z)
- Creates a new vector and sets it’s values directly with
x
,y
, andz
. - Cross (Vector B)
- Returns the cross product (a vector) of the calling vector and vector
B
. - Magnitude ( )
- Returns the magnitude of the vector as a float
- Scale (float Multiplier)
- Returns a new vector made up of the components of the this vector times
Multiplier
. You can use1 / x
as a multiplier to divide all the components by that number. Be sure to check thatx ~= 0
. - SetAll (float Value)
- Sets all the vectors components to
Value
- UnitVector ( )
- Returns the unit vector of this vector. Which is a vector with the same direction of this vector, but a magnitude of 1.
- GetDataString (Vector Self, bool Parentheses = false, bool Labels = true)
Returns a string with the vector coordinates listed. If no arguments are provided it has false, then true as it’s default args. Example usage:
a = rfg.Vector:new(1434.0, 15.0, 693.3) DataString = a.GetDataString() -- DataString == "x: 1434.0, y: 15.0, z: 693.3"