Lua API
On this page

Vector3

Tip

This is a builtin dotnet type. The documentation and api interface are generated from dotnet source files.

Represents a vector with three single-precision floating-point values.

Fields:

One Vector3

staticread only

Gets a vector whose 3 elements are equal to one.

UnitX Vector3

staticread only

Gets the vector (1,0,0).

UnitY Vector3

staticread only

Gets the vector (0,1,0).

UnitZ Vector3

staticread only

Gets the vector (0,0,1).

X number

The X component of the vector.

Y number

The Y component of the vector.

Z number

The Z component of the vector.

Zero Vector3

staticread only

Gets a vector whose 3 elements are equal to zero.

Constructors:

New(value: number) :

Creates a new Vector3 object whose three elements have the same value.

Parameters:
NameTypeDefaultSummary
valuenumber

The value to assign to all three elements.

New(value: Vector2, z: number) :

Creates a new Vector3 object from the specified Vector2 object and the specified value.

Parameters:
NameTypeDefaultSummary
valueVector2

The vector with two elements.

znumber

The additional value to assign to the Vector3.Z field.

New(x: number, y: number, z: number) :

Creates a vector whose elements have the specified values.

Parameters:
NameTypeDefaultSummary
xnumber

The value to assign to the Vector3.X field.

ynumber

The value to assign to the Vector3.Y field.

znumber

The value to assign to the Vector3.Z field.

Methods:

Abs(value: Vector3) : Vector3

static

Returns a vector whose elements are the absolute values of each of the specified vector's elements.

Parameters:
NameTypeDefaultSummary
valueVector3

A vector.

Returns:Vector3

Add(left: Vector3, right: Vector3) : Vector3

static

Adds two vectors together.

Parameters:
NameTypeDefaultSummary
leftVector3

The first vector to add.

rightVector3

The second vector to add.

Returns:Vector3

Clamp(value1: Vector3, min: Vector3, max: Vector3) : Vector3

static

Restricts a vector between a minimum and a maximum value.

Parameters:
NameTypeDefaultSummary
value1Vector3

The vector to restrict.

minVector3

The minimum value.

maxVector3

The maximum value.

Returns:Vector3

CopyTo(array: number, index: number) : nil

Copies the elements of the vector to a specified array starting at a specified index position.

Parameters:
NameTypeDefaultSummary
arraynumber

The destination array.

indexnumber

The index at which to copy the first element of the vector.

Returns:nil

CopyTo(array: number) : nil

Copies the elements of the vector to a specified array.

Parameters:
NameTypeDefaultSummary
arraynumber

The destination array.

Returns:nil

Cross(vector1,vector2) vector1 Vector3 , vector2 Vector3

Distance(value1,value2) value1 Vector3 , value2 Vector3

DistanceSquared(value1,value2) value1 Vector3 , value2 Vector3

Divide(left,divisor) left Vector3 , divisor number

Divide(left,right) left Vector3 , right Vector3

Dot(vector1,vector2) vector1 Vector3 , vector2 Vector3

Length()

LengthSquared()

Lerp(value1,value2,amount) value1 Vector3 , value2 Vector3 , amount number

Max(value1,value2) value1 Vector3 , value2 Vector3

Min(value1,value2) value1 Vector3 , value2 Vector3

Multiply(left,right) left number , right Vector3

Multiply(left,right) left Vector3 , right number

Multiply(left,right) left Vector3 , right Vector3

Negate(value) value Vector3

Normalize(value) value Vector3

Reflect(vector,normal) vector Vector3 , normal Vector3

SquareRoot(value) value Vector3

Subtract(left,right) left Vector3 , right Vector3

ToString()

ToString(format) format string

Transform(position,matrix) position Vector3 , matrix Matrix4x4

Transform(value,rotation) value Vector3 , rotation Quaternion

TransformNormal(normal,matrix) normal Vector3 , matrix Matrix4x4