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.

Vector4

A 4D vector using floating point coordinates.

Description

A 4-element structure that can be used to represent 4D coordinates or any other quadruplet 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 Vector4i for its integer counterpart.

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

Properties

float

w

0.0

float

x

0.0

float

y

0.0

float

z

0.0

Constructors

Vector4

Vector4()

Vector4

Vector4(from: Vector4)

Vector4

Vector4(from: Vector4i)

Vector4

Vector4(x: float, y: float, z: float, w: float)

Methods

Vector4

abs() const

Vector4

ceil() const

Vector4

clamp(min: Vector4, max: Vector4) const

Vector4

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

Vector4

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

Vector4

direction_to(to: Vector4) const

float

distance_squared_to(to: Vector4) const

float

distance_to(to: Vector4) const

float

dot(with: Vector4) const

Vector4

floor() const

Vector4

inverse() const

bool

is_equal_approx(to: Vector4) const

bool

is_finite() const

bool

is_normalized() const

bool

is_zero_approx() const

float

length() const

float

length_squared() const

Vector4

lerp(to: Vector4, weight: float) const

int

max_axis_index() const

int

min_axis_index() const

Vector4

normalized() const

Vector4

posmod(mod: float) const

Vector4

posmodv(modv: Vector4) const

Vector4

round() const

Vector4

sign() const