Skip to content

Archmage.Vec4

A 4D vector, the type of a vector field whose elements are not 32-bit, such as int64, uint16 or float64.

Inherits: RefCounted

A vector field whose elements are 32-bit, such as int32 or float32, is a Vector4i or Vector4 instead.

var x: Variant

An int or a float, as the element type of the field.

var y: Variant

An int or a float, as the element type of the field.

var z: Variant

An int or a float, as the element type of the field.

var w: Variant

An int or a float, as the element type of the field.

static func from_json(d: Variant, conv: Callable, e: Archmage.ParseError = null) -> Archmage.Vec4

Returns the vector in d, a parsed JSON object, converting each element with conv.call(value, e), which returns the zero value for null. For null, returns the zero vector. For any other value that is not an object, returns the zero vector too and records the type mismatch in e (see Archmage.ParseError.report_mismatch()).

func to_json() -> Dictionary

Returns the vector as a JSON object.

func to_godot() -> Variant

Returns a Vector4i when the elements are integers, or a Vector4 otherwise. A Vector4i keeps only the low 32 bits of each integer, and a Vector4 stores 32-bit floats unless Godot is built with double precision.