Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Vector3

A 3D vector using floating point coordinates.

Description

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

It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike float which is always 64-bit. If double precision is needed, compile the engine with the option precision=double.

See Vector3i for its integer counterpart.

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

Tutorials

Properties

float

x

0.0

float

y

0.0

float

z

0.0

Constructors

Vector3

Vector3 ( )

Vector3

Vector3 ( Vector3 from )

Vector3

Vector3 ( Vector3i from )

Vector3

Vector3 ( float x, float y, float z )

Methods

Vector3

abs ( ) const

float

angle_to ( Vector3 to ) const

Vector3

bezier_derivative ( Vector3 control_1, Vector3 control_2, Vector3 end, float t ) const

Vector3

bezier_interpolate ( Vector3 control_1, Vector3 control_2, Vector3 end, float t ) const

Vector3

bounce ( Vector3 n ) const

Vector3

ceil ( ) const

Vector3

clamp ( Vector3 min, Vector3 max ) const

Vector3

cross ( Vector3 with ) const

Vector3

cubic_interpolate ( Vector3 b, Vector3 pre_a, Vector3 post_b, float weight ) const

Vector3

cubic_interpolate_in_time ( Vector3 b, Vector3 pre_a, Vector3 post_b, float weight, float b_t, float pre_a_t, float post_b_t ) const

Vector3

direction_to ( Vector3 to ) const

float

distance_squared_to ( Vector3 to ) const

float

distance_to ( Vector3 to ) const

float

dot ( Vector3 with ) const

Vector3

floor ( )