Yuari
Documentation
Docs/Data types/Vector3 methods

Vector3 methods

Component-wise rounding helpers and the angle between two vectors.

Syntax

v:Angle(other: Vector3) -> number
v:Min(other: Vector3) -> Vector3
v:Max(other: Vector3) -> Vector3
v:Floor() -> Vector3
v:Ceil() -> Vector3
v:Abs() -> Vector3
v:FuzzyEq(other: Vector3, epsilon?: number) -> boolean

Parameters

ParameterTypeDescription
otherVector3Second operand for Angle, Min, Max and FuzzyEq.
epsilonnumberLargest allowed per-component difference, default 1e-5.

Returns

TypeDescription
numberAngle returns radians in the 0..π range.

Description

Min and Max compare each component independently, matching Roblox.

Angle uses acos(dot / (|a||b|)) and returns 0 when either vector has zero length, so it never produces NaN.

Floor, Ceil and Abs apply to X, Y and Z separately and return a new Vector3.

FuzzyEq compares each component within epsilon, which makes it useful for float drift checks where == would fail.

Example

local a = Vector3.new(1, 0, 0)
local b = Vector3.new(0, 1, 0)
print(a:Angle(b))                 -- 1.5707
print(Vector3.new(-1.2, 2.7, 0):Floor())  -- -2, 2, 0
print(a:Max(b))                   -- 1, 1, 0
print(a:FuzzyEq(Vector3.new(1, 0, 1e-6)))  -- true

Notes

  • Magnitude / Unit / Lerp / Dot / Cross — Also available; see the Vector3 constructor page.
  • Angle on zero vectors — Returns 0 instead of raising an error.
  • FuzzyEq epsilon — Defaults to 1e-5 and is compared against each component separately.