Vector3
public struct Vector3A 3D vector of three floats: a rendering node’s position, rotation or scale, a physics force, torque or velocity, a cast hit, or a shader vec3 uniform. Its units are those of the member it came from: a transform’s Position is in millimetres, a cast hit point in metres, a Rotation in radians and a force in newtons. The maths covers what driving transforms from logic needs.
Constructors
Section titled “Constructors”Vector3
Section titled “Vector3”public Vector3(float x, float y, float z);Creates a vector from its X, Y and Z components.
Properties you read and set
Section titled “Properties you read and set”public float X { get; set; }The X component, along the Right axis.
public float Y { get; set; }The Y component, along the Up axis.
public float Z { get; set; }The Z component. Forward points along -Z, so +Z is backward.
static
public static Vector3 Zero { get; }The vector (0, 0, 0).
static
public static Vector3 One { get; }The vector (1, 1, 1). As a Scale it means no scaling: the node at its own size.
static
public static Vector3 Up { get; }The unit vector (0, 1, 0): +Y, the up axis.
static
public static Vector3 Down { get; }The unit vector (0, -1, 0): -Y, the down axis.
static
public static Vector3 Right { get; }The unit vector (1, 0, 0): +X, the right axis.
Forward
Section titled “Forward”static
public static Vector3 Forward { get; }The unit vector (0, 0, -1). Forward is -Z, not +Z.
Methods you call
Section titled “Methods you call”Length
Section titled “Length”public float Length();Length (magnitude) of this vector, in the same units as its components.
DistanceTo
Section titled “DistanceTo”public float DistanceTo(Vector3 other);Distance from this point to other, in the same units as the components.
Normalized
Section titled “Normalized”public Vector3 Normalized();This vector scaled to length 1, keeping its direction. A zero vector returns zero rather than an error.
public float Dot(Vector3 other);Dot product with other: the sum of the products of matching components. For two unit vectors it is the cosine of the angle between them (1 for the same direction, 0 at right angles, -1 for opposite directions).
public Vector3 Cross(Vector3 other);Cross product with other: a vector at right angles to both, whose length is the product of their lengths and the sine of the angle between them. The axes are right-handed, so Right.Cross(Up) is (0, 0, 1).
static
public static Vector3 Lerp(Vector3 from, Vector3 to, float weight);Linear interpolation from from to to, component by component: a weight of 0 gives from, 1 gives to and 0.5 the midpoint. The weight is not clamped, so values outside 0 to 1 carry on past either end.
Equals
Section titled “Equals”override
public override bool Equals(object obj);True when obj is a Vector3 with exactly equal components.
GetHashCode
Section titled “GetHashCode”override
public override int GetHashCode();A hash of the components, so the vector can key a dictionary or a set.
ToString
Section titled “ToString”override
public override string ToString();The vector as text, for example Vector3(0, 1, 0).
Operators
Section titled “Operators”operator +
Section titled “operator +”static
public static Vector3 operator +(Vector3 a, Vector3 b);Adds two vectors component by component.
operator -
Section titled “operator -”static
public static Vector3 operator -(Vector3 a, Vector3 b);Subtracts b from a component by component.
static
public static Vector3 operator -(Vector3 a);Negates every component: the same length, pointing the opposite way.
operator *
Section titled “operator *”static
public static Vector3 operator *(Vector3 a, float s);Multiplies every component of a by s.
static
public static Vector3 operator *(float s, Vector3 a);Multiplies every component of a by s.
operator /
Section titled “operator /”static
public static Vector3 operator /(Vector3 a, float s);Divides every component of a by s. Dividing by zero gives infinite or NaN components, not an error.
operator ==
Section titled “operator ==”static
public static bool operator ==(Vector3 a, Vector3 b);True when all three components are exactly equal. Computed values rarely match exactly, so compare DistanceTo against a small tolerance instead.
operator !=
Section titled “operator !=”static
public static bool operator !=(Vector3 a, Vector3 b);True when any component differs, compared exactly.
Generated from the CRUMB source, commit fcec660d, 2026-10-29.

