Click or drag to resize

Basis Structure

3×3 matrix used for 3D rotation and scale. Almost always used as an orthogonal basis for a Transform. Contains 3 vector fields X, Y and Z as its columns, which are typically interpreted as the local basis vectors of a 3D transformation. For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S). Can also be accessed as array of 3D vectors. These vectors are normally orthogonal to each other, but are not necessarily normalized (due to scaling). For more information, read this documentation article: https://docs.godotengine.org/en/3.3/tutorials/math/matrices_and_transforms.html

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
[SerializableAttribute]
public struct Basis : IEquatable<Basis>

The Basis type exposes the following members.

Constructors
  NameDescription
Public methodBasis(Quat)
Constructs a pure rotation basis matrix from the given quaternion.
Public methodBasis(Vector3)
Constructs a pure rotation basis matrix from the given Euler angles (in the YXZ convention: when *composing*, first Y, then X, and Z last), given in the vector format as (X angle, Y angle, Z angle). Consider using the Basis(Quat) constructor instead, which uses a Quat quaternion instead of Euler angles.
Public methodBasis(Vector3, Single)
Constructs a pure rotation basis matrix, rotated around the given `axis` by `phi` (in radians). The axis must be a normalized vector.
Public methodBasis(Vector3, Vector3, Vector3)
Constructs a basis matrix from 3 axis vectors (matrix columns).
Top
Properties
  NameDescription
Public propertyColumn0
Column 0 of the basis matrix (the X vector).
Public propertyColumn1
Column 1 of the basis matrix (the Y vector).
Public propertyColumn2
Column 2 of the basis matrix (the Z vector).
Public propertyStatic memberFlipX
The basis that will flip something along the X axis when used in a transformation.
Public propertyStatic memberFlipY
The basis that will flip something along the Y axis when used in a transformation.
Public propertyStatic memberFlipZ
The basis that will flip something along the Z axis when used in a transformation.
Public propertyStatic memberIdentity
The identity basis, with no rotation or scaling applied. This is used as a replacement for `Basis()` in GDScript. Do not use `new Basis()` with no arguments in C#, because it sets all values to zero.
Public propertyItemInt32
Access whole columns in the form of Vector3.
Public propertyItemInt32, Int32
Access matrix elements in column-major order.
Public propertyScale
The scale of this basis.
Public propertyx
The basis matrix's X vector (column 0).
Public propertyy
The basis matrix's Y vector (column 1).
Public propertyz
The basis matrix's Z vector (column 2).
Top
Methods
  NameDescription
Public methodDeterminant
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.
Public methodEquals(Object) (Overrides ValueTypeEquals(Object).)
Public methodEquals(Basis)
Public methodGetAxis Obsolete.
Deprecated, please use the array operator instead.
Public methodGetColumn Obsolete.
Deprecated, please use the array operator instead.
Public methodGetEuler
Returns the basis's rotation in the form of Euler angles (in 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). Consider using the Quat method instead, which returns a Quat quaternion instead of Euler angles.
Public methodGetHashCode (Overrides ValueTypeGetHashCode.)
Public methodGetOrthogonalIndex
This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x, y, z) with each component being either -1, 0, or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the GridMap editor. For further details, refer to the Godot source code.
Public methodGetRow
Get rows by index. Rows are not very useful for user code, but are more efficient for some internal calculations.
Public methodGetType (Inherited from Object.)
Public methodInverse
Returns the inverse of the matrix.
Public methodIsEqualApprox
Returns true if this basis and `other` are approximately equal, by running IsEqualApprox(Vector3) on each component.
Public methodOrthonormalized
Returns the orthonormalized version of the basis matrix (useful to call occasionally to avoid rounding errors for orthogonal matrices). This performs a Gram-Schmidt orthonormalization on the basis of the matrix.
Public methodQuat
Returns the basis's rotation in the form of a quaternion. See GetEuler if you need Euler angles, but keep in mind that quaternions should generally be preferred to Euler angles.
Public methodRotated
Introduce an additional rotation around the given `axis` by `phi` (in radians). The axis must be a normalized vector.
Public methodRotationQuat
Public methodScaled
Introduce an additional scaling specified by the given 3D scaling factor.
Public methodSetColumn Obsolete.
Deprecated, please use the array operator instead.
Public methodSetRow
Sets rows by index. Rows are not very useful for user code, but are more efficient for some internal calculations.
Public methodSlerp
Assuming that the matrix is a proper rotation matrix, slerp performs a spherical-linear interpolation with another rotation matrix.
Public methodTdotx
Transposed dot product with the X axis of the matrix.
Public methodTdoty
Transposed dot product with the Y axis of the matrix.
Public methodTdotz
Transposed dot product with the Z axis of the matrix.
Public methodToString (Overrides ValueTypeToString.)
Public methodToString(String)
Public methodTransposed
Returns the transposed version of the basis matrix.
Public methodXform
Returns a vector transformed (multiplied) by the basis matrix.
Public methodXformInv
Returns a vector transformed (multiplied) by the transposed basis matrix. Note: This results in a multiplication by the inverse of the basis matrix only if it represents a rotation-reflection.
Top
Operators
Fields
  NameDescription
Public fieldRow0
Row 0 of the basis matrix. Shows which vectors contribute to the X direction. Rows are not very useful for user code, but are more efficient for some internal calculations.
Public fieldRow1
Row 1 of the basis matrix. Shows which vectors contribute to the Y direction. Rows are not very useful for user code, but are more efficient for some internal calculations.
Public fieldRow2
Row 2 of the basis matrix. Shows which vectors contribute to the Z direction. Rows are not very useful for user code, but are more efficient for some internal calculations.
Top
See Also