Vector3
Overview
Description
Vector3
represents a vector used in 3D space that includes x, y, and z coordinates. It is commonly used in 3D rendering, physics calculations, and position computations.
Properties
X
number
Represents the X-axis coordinate value.
Code Samples
local Vector = Vector3.new(10, 5, 8)
print(Vector.X)
Y
number
Represents the Y-axis coordinate value.
Code Samples
local Vector = Vector3.new(10, 5, 8)
print(Vector.Y)
Z
number
Represents the Z-axis coordinate value.
Code Samples
local Vector = Vector3.new(10, 5, 8)
print(Vector.Z)
zero
Vector3
A vector where all axis values are 0. (0, 0, 0)
Code Samples
local ZeroVector = Vector3.zero
print(ZeroVector)
one
Vector3
A vector where all axis values equal 1. (1, 1, 1)
Code Samples
local OneVector = Vector3.one
print(OneVector)
xAxis
Vector3
The unit vector defined in the direction of the X-axis.
Code Samples
local XAxis = Vector3.xAxis
print(XAxis)
yAxis
Vector3
The unit vector defined in the direction of the Y-axis.
Code Samples
local YAxis = Vector3.yAxis
print(YAxis)
zAxis
Vector3
The unit vector defined in the direction of the Z-axis.
Code Samples
local ZAxis = Vector3.zAxis
print(ZAxis)
Unit
Normalizes the vector to produce a unit vector.
Code Samples
local Vector = Vector3.new(100, 50, 200)
print(Vector.Unit)
Magnitude
The magnitude (length) of the vector
Code Samples
local Vector = Vector3.new(100, 50, 200)
print(Vector.Magnitude)
Constructors
new
Creates a Vector3
instance with specified x, y, and z coordinates.
Parameters
number x
The x-coordinate value
number y
The y-coordinate value
number z
The z-coordinate value
Return
Vector3
A new instance of Vector3
Code Samples
local Vector = Vector3.new(1, 2, 3)
print(Vector)
Methods
Dot
It returns the scalar inner product of the two vectors.
Parameters
Vector3
vector
Parameter for dot product.
Return
number
Result of dot product calculation.
Code Samples
Cross
It returns the vector cross product of the two vectors.
Parameters
Vector3
Parameter for cross product.
Return
Vector3
Result of cross product calculation.
Code Samples
Last updated