Luduvo Contents
Theme
On this page

Vector3

3D positions, directions, and velocities, with the axis and zero vectors alongside

Constructors

6 members Access: shared

new(x: number, y: number, z: number) -> vector

make a vector

Parameters
NameTypeDescription
xnumberComponent along the X axis in studs.
ynumberComponent along the Y axis in studs.
znumberComponent along the Z axis in studs.
returnsvector—
one: vector

the all-ones vector

xAxis: vector

the x axis

yAxis: vector

the y axis

zAxis: vector

the z axis

zero: vector

the zero vector

3D Vector Math and Distances

Lifecycle: Shared

Subtraction, .Magnitude, and .Unit cover most distance and direction work.

Luau
local startPos = Vector3.new(0, 10, 0)local targetPos = Vector3.new(12, 10, 16)local displacement = targetPos - startPoslocal distance = displacement.Magnitudelocal direction = displacement.Unitprint(string.format("Distance: %.2f, Direction: %s", distance, tostring(direction)))