Attention: Here be dragons
This is the
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
A 3×3 matrix for representing 3D rotation and scale.
A 3×3 matrix used for representing 3D rotation and scale. Usually used as an orthogonal basis for a Transform3D.
Contains 3 vector fields X, Y and Z as its columns, which are typically interpreted as the local basis vectors of a transformation. For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S).
Basis can also be accessed as an array of 3D vectors. These vectors are usually orthogonal to each other, but are not necessarily normalized (due to scaling).
For more information, read the "Matrices and transforms" documentation article.
There are notable differences when using this API with C#. See C# API 与 GDScript 的差异 for more information.
Basis ( )
determinant ( ) const
get_rotation_quaternion ( ) const
get_scale ( ) const
inverse ( ) const
is_finite ( ) const
orthonormalized ( ) const
transposed ( ) const
Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)
The identity basis, with no rotation or scaling applied.
This is identical to calling
Basis() without any parameters. This constant can be used to make your code clearer, and for consistency with C#.
Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1)
The basis that will flip something along the X axis when used in a transformation.
Basis(1, 0, 0, 0, -1, 0, 0, 0, 1)
The basis that will flip something along the Y axis when used in a transformation.
Basis(1, 0, 0, 0, 1, 0, 0, 0, -1)
The basis that will flip something along the Z axis when used in a transformation.
Vector3 x =
Vector3(1, 0, 0)
The basis matrix's X vector (column 0). Equivalent to array index
Vector3 y =
Vector3(0, 1, 0)
The basis matrix's Y vector (column 1). Equivalent to array index
Vector3 z =
Vector3(0, 0, 1)
The basis matrix's Z vector (column 2). Equivalent to array index
Basis Basis ( )
Constructs a default-initialized Basis set to IDENTITY.
Constructs a Basis as a copy of the given Basis.
Constructs a pure rotation basis matrix, rotated around the given
angle (in radians). The axis must be a normalized vector.
Constructs a pure rotation basis matrix from the given quaternion.
Constructs a basis matrix from 3 axis vectors (matrix columns).
float determinant ( ) const
Returns the determinant of the basis matrix. If the basis is uniformly scaled, its determinant is the square of the scale.
A negative determinant means the basis has a negative scale. A zero determinant means the basis isn't invertible, and is usually considered invalid.
Constructs a pure rotation Basis matrix from Euler angles in the specified Euler rotation order. By default, use YXZ order (most common). See the EulerOrder enum for possible values.
Constructs a pure scale basis matrix with no rotation or shearing. The scale values are set as the diagonal of the matrix, and the other parts of the matrix are zero.
Returns the basis's rotation in the form of Euler angles. The Euler order depends on the
order parameter, by default it uses the YXZ convention: when decomposing, first Z, then X, and Y last. The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
Quaternion get_rotation_quaternion ( ) const