Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
Axis
Vector3i.swift:20enum Axis
Cases
case x
Enumerated value for the X axis. Returned by
maxAxisIndex
andminAxisIndex
.case y
Enumerated value for the Y axis. Returned by
maxAxisIndex
andminAxisIndex
.case z
Enumerated value for the Z axis. Returned by
maxAxisIndex
andminAxisIndex
.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (52) members.
Type members
init(
) Constructs a default-initialized
Vector3i
with all components set to0
.init(from: Vector3i
) init(from: Vector3
) Constructs a new
Vector3i
from the givenVector3
by truncating components’ fractional parts (rounding towards zero). For a different behavior consider passing the result ofceil
,floor
orround
to this constructor instead.init(x: Int32, y: Int32, z: Int32
) Returns a
Vector3i
with the given components.static let axisX: Int
Enumerated value for the X axis. Returned by
maxAxisIndex
andminAxisIndex
.static let axisY: Int
Enumerated value for the Y axis. Returned by
maxAxisIndex
andminAxisIndex
.static let axisZ: Int
Enumerated value for the Z axis. Returned by
maxAxisIndex
andminAxisIndex
.static let back: Vector3i
Back unit vector. Represents the local direction of back, and the global direction of south.
static let down: Vector3i
Down unit vector.
static let forward: Vector3i
Forward unit vector. Represents the local direction of forward, and the global direction of north.
static var godotType: Variant.GType
static let left: Vector3i
Left unit vector. Represents the local direction of left, and the global direction of west.
static let max: Vector3i
Max vector, a vector with all components equal to
INT32_MAX
. Can be used as an integer equivalent ofVector3.INF
.static let min: Vector3i
Min vector, a vector with all components equal to
INT32_MIN
. Can be used as a negative integer equivalent ofVector3.INF
.static let one: Vector3i
One vector, a vector with all components set to
1
.static let right: Vector3i
Right unit vector. Represents the local direction of right, and the global direction of east.
static let up: Vector3i
Up unit vector.
static let zero: Vector3i
Zero vector, a vector with all components set to
0
.static func != (lhs: Vector3i, rhs: Vector3i
) -> Bool Returns
true
if the vectors are not equal.static func % (lhs: Vector3i, rhs: Vector3i
) -> Vector3i Gets the remainder of each component of the
Vector3i
with the given integer. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using@GlobalScope.posmod
instead if you want to handle negative numbers.static func % (lhs: Vector3i, rhs: Int64
) -> Vector3i Gets the remainder of each component of the
Vector3i
with the given integer. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using@GlobalScope.posmod
instead if you want to handle negative numbers.static func %= (left: inout `Self`, right: `Self`
) static func * (lhs: Vector3i, rhs: Vector3i
) -> Vector3i Multiplies each component of the
Vector3i
by the given integer.static func * (lhs: Vector3i, rhs: Int64
) -> Vector3i Multiplies each component of the
Vector3i
by the given integer.static func * (lhs: Vector3i, rhs: Double
) -> Vector3 Multiplies each component of the
Vector3i
by the given integer.static func *= (left: inout `Self`, right: `Self`
) static func + (lhs: Vector3i, rhs: Vector3i
) -> Vector3i Adds each component of the
Vector3i
by the components of the givenVector3i
.static func += (left: inout `Self`, right: `Self`
) static func - (v: `Self`
) -> Vector3i Returns the negative value of the Vector3i. This is the same as writing Vector3i(-v.x, -v.y, -v.z). This operation flips the direction of the vector while keeping the same magnitude.
static func - (lhs: Vector3i, rhs: Vector3i
) -> Vector3i Subtracts each component of the
Vector3i
by the components of the givenVector3i
.static func -= (left: inout `Self`, right: `Self`
) static func / (lhs: Vector3i, rhs: Vector3i
) -> Vector3i Divides each component of the
Vector3i
by the given integer.static func / (lhs: Vector3i, rhs: Int64
) -> Vector3i Divides each component of the
Vector3i
by the given integer.static func / (lhs: Vector3i, rhs: Double
) -> Vector3 Divides each component of the
Vector3i
by the given integer.static func /= (left: inout `Self`, right: `Self`
) static func < (lhs: Vector3i, rhs: Vector3i
) -> Bool Compares two
Vector3i
vectors by first checking if the X value of the left vector is less than the X value of theright
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.static func <= (lhs: Vector3i, rhs: Vector3i
) -> Bool 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 theright
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.static func == (lhs: Vector3i, rhs: Vector3i
) -> Bool Returns
true
if the vectors are equal.static func > (lhs: Vector3i, rhs: Vector3i
) -> Bool Compares two
Vector3i
vectors by first checking if the X value of the left vector is greater than the X value of theright
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.static func >= (lhs: Vector3i, rhs: Vector3i
) -> Bool 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 theright
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.
Instance members
var x: Int32
The vector’s X component. Also accessible by using the index position
[0]
.var y: Int32
The vector’s Y component. Also accessible by using the index position
[1]
.var z: Int32
The vector’s Z component. Also accessible by using the index position
[2]
.subscript(Int64
) -> Int64 func abs(
) -> Vector3i Returns a new vector with all components in absolute values (i.e. positive).
func clamp(min: Vector3i, max: Vector3i
) -> Vector3i Returns a new vector with all components clamped between the components of
min
andmax
, by running@GlobalScope.clamp
on each component.func length(
) -> Double Returns the length (magnitude) of this vector.
func lengthSquared(
) -> Int64 Returns the squared length (squared magnitude) of this vector.
func maxAxisIndex(
) -> Int64 Returns the axis of the vector’s highest value. See
AXIS_*
constants. If all components are equal, this method returns .x.func minAxisIndex(
) -> Int64 Returns the axis of the vector’s lowest value. See
AXIS_*
constants. If all components are equal, this method returns .z.func sign(
) -> Vector3i Returns a new vector with each component set to
1
if it’s positive,-1
if it’s negative, and0
if it’s zero. The result is identical to calling@GlobalScope.sign
on each component.func snapped(step: `Self`
) -> Vector3i
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.