Vector3i

A 3D vector using integer coordinates.

Description

A 3-element structure that can be used to represent 3D grid coordinates or any other triplet of integers.

It uses integer coordinates and is therefore preferable to Vector3 when exact precision is required. Note that the values are limited to 32 bits, and unlike Vector3 this cannot be configured with an engine build option. Use int or PackedInt64Array if 64-bit values are needed.

Note: In a boolean context, a Vector3i will evaluate to false if it's equal to Vector3i(0, 0, 0). Otherwise, a Vector3i will always evaluate to true.

Tutorials

Properties

int

x

0

int

y

0

int

z

0

Constructors

Vector3i

Vector3i ( )

Vector3i

Vector3i ( Vector3i from )

Vector3i

Vector3i ( Vector3 from )

Vector3i

Vector3i ( int x, int y, int z )

Methods

Vector3i

abs ( ) const

Vector3i

clamp ( Vector3i min, Vector3i max ) const

float

length ( ) const

int

length_squared ( ) const

int

max_axis_index ( ) const

int

min_axis_index ( ) const

Vector3i

sign ( ) const

Vector3i

snapped ( Vector3i step ) const

Operators

bool

operator != ( Vector3i right )

Vector3i

operator % ( Vector3i right )

Vector3i

operator % ( int right )

Vector3i

operator * ( Vector3i right )

Vector3

operator * ( float right )

Vector3i

operator * ( int right )

Vector3i

operator + ( Vector3i right )

Vector3i

operator - ( Vector3i right )

Vector3i

operator / ( Vector3i right )

Vector3

operator / ( float right )

Vector3i

operator / ( int right )

bool

operator < ( Vector3i right )

bool

operator <= ( Vector3i right )

bool

operator == ( Vector3i right )

bool

operator > ( Vector3i right )

bool

operator >= ( Vector3i right )

int

operator [] (