Name | Type |
---|---|
x | float |
y | float |
z | float |
Returns:
Type | Description |
---|---|
bool | true if all vector axes equals zero |
Code:
local vecZero = Vector.new(0.0, 0.0, 0.0)
local bIsZero = vecZero.IsZero()
Returns:
Type | Description |
---|---|
bool | true if all vector axes is finite |
Code:
local vecValid = Vector.new(1.0, 1.0, 1.0)
local bIsValid = vecValid.IsValid()
Returns:
Type | Description |
---|---|
float | length of current vector |
Code:
local vecTest = Vector.new(100.0, 100.0, 100.0)
local flLength = vecTest.Length()
Returns:
Type | Description |
---|---|
float | squared length of current vector |
Code:
local vecTest = Vector.new(100.0, 100.0, 100.0)
local flSquaredLength = vecTest.LengthSqr()
Returns:
Type | Description |
---|---|
float | length of current vector, only x and y axes |
Code:
local vecTest = Vector.new(100.0, 100.0, 100.0)
local flLength2D = vecTest.Length2D()
Returns:
Type | Description |
---|---|
float | squared length of current vector, only x and y axes |
Code:
local vecTest = Vector.new(100.0, 100.0, 100.0)
local flSquaredLength2D = vecTest.Length2DSqr()
Parameters:
Name | Type | Description |
---|---|---|
vecEnd | Vector | end point to calculate distance from current vector |
Returns:
Type | Description |
---|---|
float | distance between current and given vector |
Code:
local vecStart = Vector.new(100.0, 100.0, 100.0)
local vecEnd = Vector.new(200.0, 200.0, 200.0)
local flDist = vecStart.DistTo(vecEnd)
Parameters:
Name | Type | Description |
---|---|---|
vecEnd | Vector | end point to calculate distance from current vector |
Returns:
Type | Description |
---|---|
float | squared distance between current and given vector |
Code:
local vecStart = Vector.new(100.0, 100.0, 100.0)
local vecEnd = Vector.new(200.0, 200.0, 200.0)
local flDistSqr = vecStart.DistToSqr(vecEnd)
Parameters:
Name | Type | Description |
---|---|---|
vecDot | Vector | point to calculate dot of current vector with |
Returns:
Type | Description |
---|---|
Vector | dot product of current and given vectors |
Code:
local vecToDot = Vector.new(100.0, 100.0, 100.0)
local vecDot = Vector.new(200.0, 200.0, 200.0)
local vecDotProduct = vecToDot.CrossProduct(vecDot)
Parameters:
Name | Type | Description |
---|---|---|
vecCross | Vector | point to calculate cross of current vector with |
Returns:
Type | Description |
---|---|
Vector | cross product of current and given vectors |
Code:
local vecToCross = Vector.new(100.0, 100.0, 100.0)
local vecCross = Vector.new(200.0, 200.0, 200.0)
local vecCrossProduct = vecToCross.CrossProduct(vecCross)
Returns:
Type | Description |
---|---|
Vector | normalized to legit values vector |
Code:
local vecTest = Vector.new(0.025, 0.025, 0.025)
-- create a copy of vecTest, then NormalizeInPlace it and assign normalized vector to copied vector
local vecNormalized = vecTest.Normalized()
Returns:
Type | Description |
---|---|
float | lenght of vector |
Code:
local vecTest = Vector.new(0.025, 0.025, 0.025)
local flLenght = vecTest.NormalizeInPlace()