class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS Vector4
A 4D vector using floating-point coordinates.
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.
Enum Axis<>():Enum

AXIS_X:null = 0
Enumerated value for the X axis. Returned by max_axis_index and min_axis_index.


AXIS_Y:null = 1
Enumerated value for the Y axis. Returned by max_axis_index and min_axis_index.


AXIS_Z:null = 2
Enumerated value for the Z axis. Returned by max_axis_index and min_axis_index.


AXIS_W:null = 3
Enumerated value for the W axis. Returned by max_axis_index and min_axis_index.
* Constants<>():*

ZERO:null = Vector4(0, 0, 0, 0)
Zero vector, a vector with all components set to 0.


ONE:null = Vector4(1, 1, 1, 1)
One vector, a vector with all components set to 1.


INF:null = Vector4(inf, inf, inf, inf)
Infinity vector, a vector with all components set to [constant @GDScript.INF].
set get float w<>():float set get
The vector's W component. Also accessible by using the index position [3].

set get float x<>():float set get
The vector's X component. Also accessible by using the index position [0].

set get float y<>():float set get
The vector's Y component. Also accessible by using the index position [1].

set get float z<>():float set get
The vector's Z component. Also accessible by using the index position [2].

Vector4 abs<>():Vector4
Returns a new vector with all components in absolute values (i.e. positive).

Vector4 ceil<>():Vector4
Returns a new vector with all components rounded up (towards positive infinity).

Vector4 clamp<>( Vector4 min=, min:Vector4=, Vector4 max=, max:Vector4=, ):Vector4
Returns a new vector with all components clamped between the components of min and max, by running [method @GlobalScope.clamp] on each component.

Vector4 clampf<>( float min=, min:float=, float max=, max:float=, ):Vector4
Returns a new vector with all components clamped between min and max, by running [method @GlobalScope.clamp] on each component.

Vector4 cubic_interpolate<>( Vector4 b=, b:Vector4=, Vector4 pre_a=, pre_a:Vector4=, Vector4 post_b=, post_b:Vector4=, float weight=, weight:float=, ):Vector4
Performs a cubic interpolation between this vector and b using pre_a and post_b as handles, and returns the result at position weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.

Vector4 cubic_interpolate_in_time<>( Vector4 b=, b:Vector4=, Vector4 pre_a=, pre_a:Vector4=, Vector4 post_b=, post_b:Vector4=, float weight=, weight:float=, float b_t=, b_t:float=, float pre_a_t=, pre_a_t:float=, float post_b_t=, post_b_t:float=, ):Vector4
Performs a cubic interpolation between this vector and b using pre_a and post_b as handles, and returns the result at position weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.

It can perform smoother interpolation than cubic_interpolate by the time values.
Vector4 direction_to<>( Vector4 to=, to:Vector4=, ):Vector4
Returns the normalized vector pointing from this vector to to. This is equivalent to using (b - a).normalized().

float distance_squared_to<>( Vector4 to=, to:Vector4=, ):float
Returns the squared distance between this vector and to.

This method runs faster than distance_to, so prefer it if you need to compare vectors or need the squared distance for some formula.
float distance_to<>( Vector4 to=, to:Vector4=, ):float
Returns the distance between this vector and to.

float dot<>( Vector4 with=, with:Vector4=, ):float
Returns the dot product of this vector and with.

Vector4 floor<>():Vector4
Returns a new vector with all components rounded down (towards negative infinity).

Vector4 inverse<>():Vector4
Returns the inverse of the vector. This is the same as Vector4(1.0 / v.x, 1.0 / v.y, 1.0 / v.z, 1.0 / v.w).

bool is_equal_approx<>( Vector4 to=, to:Vector4=, ):bool
Returns true if this vector and to are approximately equal, by running [method @GlobalScope.is_equal_approx] on each component.

bool is_finite<>():bool
Returns true if this vector is finite, by calling [method @GlobalScope.is_finite] on each component.

bool is_normalized<>():bool
Returns true if the vector is normalized, i.e. its length is approximately equal to 1.

bool is_zero_approx<>():bool
Returns true if this vector's values are approximately zero, by running [method @GlobalScope.is_zero_approx] on each component.

This method is faster than using is_equal_approx with one value as a zero vector.
float length<>():float
Returns the length (magnitude) of this vector.

float length_squared<>():float
Returns the squared length (squared magnitude) of this vector.

This method runs faster than length, so prefer it if you need to compare vectors or need the squared distance for some formula.
Vector4 lerp<>( Vector4 to=, to:Vector4=, float weight=, weight:float=, ):Vector4
Returns the result of the linear interpolation between this vector and to by amount weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.

Vector4 max<>( Vector4 with=, with:Vector4=, ):Vector4
Returns the component-wise maximum of this and with, equivalent to Vector4(maxf(x, with.x), maxf(y, with.y), maxf(z, with.z), maxf(w, with.w)).

int max_axis_index<>():int
Returns the axis of the vector's highest value. See AXIS_* constants. If all components are equal, this method returns AXIS_X.

Vector4 maxf<>( float with=, with:float=, ):Vector4
Returns the component-wise maximum of this and with, equivalent to Vector4(maxf(x, with), maxf(y, with), maxf(z, with), maxf(w, with)).

Vector4 min<>( Vector4 with=, with:Vector4=, ):Vector4
Returns the component-wise minimum of this and with, equivalent to Vector4(minf(x, with.x), minf(y, with.y), minf(z, with.z), minf(w, with.w)).

int min_axis_index<>():int
Returns the axis of the vector's lowest value. See AXIS_* constants. If all components are equal, this method returns AXIS_W.

Vector4 minf<>( float with=, with:float=, ):Vector4
Returns the component-wise minimum of this and with, equivalent to Vector4(minf(x, with), minf(y, with), minf(z, with), minf(w, with)).

Vector4 normalized<>():Vector4
Returns the result of scaling the vector to unit length. Equivalent to v / v.length(). Returns (0, 0, 0, 0) if v.length() == 0. See also is_normalized.

Note: This function may return incorrect values if the input vector length is near zero.
Vector4 posmod<>( float mod=, mod:float=, ):Vector4
Returns a vector composed of the [method @GlobalScope.fposmod] of this vector's components and mod.

Vector4 posmodv<>( Vector4 modv=, modv:Vector4=, ):Vector4
Returns a vector composed of the [method @GlobalScope.fposmod] of this vector's components and modv's components.

Vector4 round<>():Vector4
Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.

Vector4 sign<>():Vector4
Returns a new vector with each component set to 1.0 if it's positive, -1.0 if it's negative, and 0.0 if it's zero. The result is identical to calling [method @GlobalScope.sign] on each component.

Vector4 snapped<>( Vector4 step=, step:Vector4=, ):Vector4
Returns a new vector with each component snapped to the nearest multiple of the corresponding component in step. This can also be used to round the components to an arbitrary number of decimals.

Vector4 snappedf<>( float step=, step:float=, ):Vector4
Returns a new vector with each component snapped to the nearest multiple of step. This can also be used to round the components to an arbitrary number of decimals.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...