Creates a vector from its components.
X component.
Y component.
Z component.
The magnitude (Euclidean length) of the vector.
Involves a square root. If you only need to compare magnitudes, prefer
Vector3.lengthSquared to avoid the Math.sqrt call.
The squared magnitude of the vector.
Cheaper than Vector3.length because it skips the square root. Order is preserved, so it is ideal for "which is closer" comparisons.
Euclidean distance to another point.
The other point.
The distance.
Vector3.distanceToSquared for a cheaper comparison-only variant.
Squared Euclidean distance to another point.
The other point.
The squared distance.
Dot product with another vector.
The other vector.
The scalar dot product. 0 means the vectors are perpendicular.
Compares two vectors for approximate equality.
The vector to compare against.
Maximum allowed per-component difference.
true if every component is within epsilon of v.
Returns a unit vector pointing in the same direction.
A new vector with length 1, or Vector3.zero if this vector
has zero length (avoids dividing by zero).
Converts to a plain [x, y, z] tuple.
The components as a fixed-length array.
A human-readable representation, e.g. "Vector3(1, 2, 3)".
The formatted string.
StaticfromStaticzero
An immutable-by-convention 3D vector with common math operations.
Remarks
Every operation returns a new
Vector3rather than mutating in place, so instances are safe to share. Because the publicx/y/zfields satisfy IVector3, an instance can be passed directly to any native that expects a coordinate shape (e.g.SetEntityCoords).Example