Skip to content

Vector3

Vector3 is a 3D vector with an x, y and z component.

Not newable

This object cannot be created by scripts using Instance.New().

Properties

X : number

The X component of the vector.

Y : number

The Y component of the vector.

Z : number

The Z component of the vector.

Forward : Vector3

Shorthand for Vector3.New(0, 0, -1).

Back : Vector3

Shorthand for Vector3.New(0, 0, 1).

Down : Vector3

Shorthand for Vector3.New(0, -1, 0).

Left : Vector3

Shorthand for Vector3.New(-1, 0, 0).

One : Vector3

Shorthand for Vector3.New(1, 1, 1).

Zero : Vector3

Shorthand for Vector3.New(0, 0, 0).

Shorthand for Vector3.New(1, 0, 0).

Up : Vector3

Shorthand for Vector3.New(0, 1, 0).

Magnitude : number

The length of the vector.

Normalized : Vector3

The normalized version of the vector.

SqrMagnitude : number

The squared length of the vector.

Methods

New → Vector3

Parameters: ``

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New → Vector3

Parameters: d [ number ]

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New → Vector3

Parameters

x [ number ]

y [ number ]

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New → Vector3

Parameters

x [ number ]

y [ number ]

z [ number ]

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New → Vector3

Parameters: v [ Vector2 ]

Returns a new Vector3 with the given Vector2 components and a z component of 0.

Angle → number

Parameters

from [ Vector3 ]

to [ Vector3 ]

Returns the angle in degrees between from and to.

Cross → Vector3

Parameters

lhs [ Vector3 ]

rhs [ Vector3 ]

Returns the cross product of lhs and rhs.

Distance → number

Parameters

a [ Vector3 ]

b [ Vector3 ]

Returns the distance between a and b.

Dot → number

Parameters

lhs [ Vector3 ]

rhs [ Vector3 ]

Returns the dot product of lhs and rhs.

Lerp → Vector3

Parameters

a [ Vector3 ]

b [ Vector3 ]

t [ number ]

Returns a new Vector3 that is the linear interpolation between a and b by t.

Max → Vector3

Parameters

lhs [ Vector3 ]

rhs [ Vector3 ]

Returns a vector that is made from the largest components of two vectors.

Min → Vector3

Parameters

lhs [ Vector3 ]

rhs [ Vector3 ]

Returns a vector that is made from the smallest components of two vectors.

MoveTowards → Vector3

Parameters

current [ Vector3 ]

target [ Vector3 ]

maxDistanceDelta [ number ]

Calculate a position between the points specified by current and target, moving no farther than the distance specified by maxDistanceDelta.

Normalize → Vector3

Parameters: value [ Vector3 ]

Returns a new Vector3 that is the normalized version of the given vector.

Project → Vector3

Parameters

vector [ Vector3 ]

onNormal [ Vector3 ]

Returns the projection of a vector onto another vector.

Reflect → Vector3

Parameters

inDirection [ Vector3 ]

inNormal [ Vector3 ]

Returns the reflection of a vector off the plane defined by a normal.

SignedAngle → number

Parameters

from [ Vector3 ]

to [ Vector3 ]

axis [ Vector3 ]

Returns the signed angle in degrees between from and to.

Slerp → Vector3

Parameters

a [ Vector3 ]

b [ Vector3 ]

t [ number ]

Spherically interpolates between two vectors.