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(from: Vector3)

Vector3

Vector3(from: Vector3i)

Vector3

Vector3(x: float, y: float, z: float)

Methods

Vector3

abs() const

float

angle_to(to: Vector3) const

Vector3

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

Vector3

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

Vector3

bounce(n: Vector3) const

Vector3

ceil() const

Vector3

clamp(min: Vector3, max: Vector3) const

Vector3

cross(with: Vector3) const

Vector3

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

Vector3

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

Vector3

direction_to(to: Vector3) const

float

distance_squared_to(to: Vector3) const

float

distance_to(to: Vector3) const

float

dot(with: Vector3) const

Vector3

floor() const

Vector3

inverse() const

bool

is_equal_approx(to: Vector3) const

bool

is_finite() const

bool

is_normalized() const

bool

is_zero_approx() const

float

length() const

float

length_squared() const