Vector used for 3D math using integer coordinates. 3-element structure that can be used to represent positions in 3D space or any other triplet of numeric values. It uses integer coordinates and is therefore preferable to [Vector3] when exact precision is required. Note that the values are limited to 32 bits, and unlike [Vector3] this cannot be configured with an engine build option. Use [int] or [PackedInt64Array] if 64-bit values are needed. [b]Note:[/b] In a boolean context, a Vector3i will evaluate to [code]false[/code] if it's equal to [code]Vector3i(0, 0, 0)[/code]. Otherwise, a Vector3i will always evaluate to [code]true[/code]. $DOCS_URL/tutorials/math/index.html $DOCS_URL/tutorials/math/vector_math.html https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab Constructs a default-initialized [Vector3i] with all components set to [code]0[/code]. Constructs a [Vector3i] as a copy of the given [Vector3i]. Constructs a new [Vector3i] from [Vector3]. The floating point coordinates will be truncated. Returns a [Vector3i] with the given components. Returns a new vector with all components in absolute values (i.e. positive). Returns a new vector with all components clamped between the components of [param min] and [param max], by running [method @GlobalScope.clamp] on each component. Returns the length (magnitude) of this vector. Returns the squared length (squared magnitude) of this vector. This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula. Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X]. Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z]. Returns the vector with each component set to one or negative one, depending on the signs of the components. The vector's X component. Also accessible by using the index position [code][0][/code]. The vector's Y component. Also accessible by using the index position [code][1][/code]. The vector's Z component. Also accessible by using the index position [code][2][/code]. Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index]. Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index]. Enumerated value for the Z axis. Returned by [method max_axis_index] and [method min_axis_index]. Zero vector, a vector with all components set to [code]0[/code]. One vector, a vector with all components set to [code]1[/code]. Left unit vector. Represents the local direction of left, and the global direction of west. Right unit vector. Represents the local direction of right, and the global direction of east. Up unit vector. Down unit vector. Forward unit vector. Represents the local direction of forward, and the global direction of north. Back unit vector. Represents the local direction of back, and the global direction of south. Returns [code]true[/code] if the vectors are not equal. Gets the remainder of each component of the [Vector3i] with the components of the given [Vector3i]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers. [codeblock] print(Vector3i(10, -20, 30) % Vector3i(7, 8, 9)) # Prints "(3, -4, 3)" [/codeblock] Gets the remainder of each component of the [Vector3i] with the the given [int]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers. [codeblock] print(Vector3i(10, -20, 30) % 7) # Prints "(3, -6, 2)" [/codeblock] Multiplies each component of the [Vector3i] by the components of the given [Vector3i]. [codeblock] print(Vector3i(10, 20, 30) * Vector3i(3, 4, 5)) # Prints "(30, 80, 150)" [/codeblock] Multiplies each component of the [Vector3i] by the given [float]. Returns a [Vector3]. [codeblock] print(Vector3i(10, 15, 20) * 0.9) # Prints "(9, 13.5, 18)" [/codeblock] Multiplies each component of the [Vector3i] by the given [int]. Adds each component of the [Vector3i] by the components of the given [Vector3i]. [codeblock] print(Vector3i(10, 20, 30) + Vector3i(3, 4, 5)) # Prints "(13, 24, 35)" [/codeblock] Subtracts each component of the [Vector3i] by the components of the given [Vector3i]. [codeblock] print(Vector3i(10, 20, 30) - Vector3i(3, 4, 5)) # Prints "(7, 16, 25)" [/codeblock] Divides each component of the [Vector3i] by the components of the given [Vector3i]. [codeblock] print(Vector3i(10, 20, 30) / Vector3i(2, 5, 3)) # Prints "(5, 4, 10)" [/codeblock] Divides each component of the [Vector3i] by the given [float]. Returns a [Vector3]. [codeblock] print(Vector3i(10, 20, 30) / 2.9) # Prints "(5, 10, 15)" [/codeblock] Divides each component of the [Vector3i] by the given [int]. Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than the X value of the [param right] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [param right] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. Returns [code]true[/code] if the vectors are equal. Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than the X value of the [param right] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [param right] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. Access vector components using their [param index]. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code]. Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable. Returns the negative value of the [Vector3i]. This is the same as writing [code]Vector3i(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude.