Basis Structure |
Namespace: Godot
[SerializableAttribute] public struct Basis : IEquatable<Basis>
The Basis type exposes the following members.
Name | Description | |
---|---|---|
Basis(Quat) |
Constructs a pure rotation basis matrix from the given quaternion.
| |
Basis(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.
| |
Basis(Vector3, Single) |
Constructs a pure rotation basis matrix, rotated around the given `axis`
by `phi` (in radians). The axis must be a normalized vector.
| |
Basis(Vector3, Vector3, Vector3) |
Constructs a basis matrix from 3 axis vectors (matrix columns).
|
Name | Description | |
---|---|---|
Column0 |
Column 0 of the basis matrix (the X vector).
| |
Column1 |
Column 1 of the basis matrix (the Y vector).
| |
Column2 |
Column 2 of the basis matrix (the Z vector).
| |
FlipX |
The basis that will flip something along the X axis when used in a transformation.
| |
FlipY |
The basis that will flip something along the Y axis when used in a transformation.
| |
FlipZ |
The basis that will flip something along the Z axis when used in a transformation.
| |
Identity |
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.
| |
ItemInt32 |
Access whole columns in the form of Vector3.
| |
ItemInt32, Int32 |
Access matrix elements in column-major order.
| |
Scale |
The scale of this basis.
| |
x |
The basis matrix's X vector (column 0).
| |
y |
The basis matrix's Y vector (column 1).
| |
z |
The basis matrix's Z vector (column 2).
|
Name | Description | |
---|---|---|
Determinant |
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.
| |
Equals(Object) | (Overrides ValueTypeEquals(Object).) | |
Equals(Basis) | ||
GetAxis | Obsolete.
Deprecated, please use the array operator instead.
| |
GetColumn | Obsolete.
Deprecated, please use the array operator instead.
| |
GetEuler |
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.
| |
GetHashCode | (Overrides ValueTypeGetHashCode.) | |
GetOrthogonalIndex |
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.
| |
GetRow |
Get rows by index. Rows are not very useful for user code,
but are more efficient for some internal calculations.
| |
GetType | (Inherited from Object.) | |
Inverse |
Returns the inverse of the matrix.
| |
IsEqualApprox |
Returns true if this basis and `other` are approximately equal, by running
IsEqualApprox(Vector3) on each component.
| |
Orthonormalized |
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.
| |
Quat |
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.
| |
Rotated |
Introduce an additional rotation around the given `axis`
by `phi` (in radians). The axis must be a normalized vector.
| |
RotationQuat | ||
Scaled |
Introduce an additional scaling specified by the given 3D scaling factor.
| |
SetColumn | Obsolete.
Deprecated, please use the array operator instead.
| |
SetRow |
Sets rows by index. Rows are not very useful for user code,
but are more efficient for some internal calculations.
| |
Slerp |
Assuming that the matrix is a proper rotation matrix, slerp performs
a spherical-linear interpolation with another rotation matrix.
| |
Tdotx |
Transposed dot product with the X axis of the matrix.
| |
Tdoty |
Transposed dot product with the Y axis of the matrix.
| |
Tdotz |
Transposed dot product with the Z axis of the matrix.
| |
ToString | (Overrides ValueTypeToString.) | |
ToString(String) | ||
Transposed |
Returns the transposed version of the basis matrix.
| |
Xform |
Returns a vector transformed (multiplied) by the basis matrix.
| |
XformInv |
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.
|
Name | Description | |
---|---|---|
Equality | ||
Inequality | ||
Multiply |
Name | Description | |
---|---|---|
Row0 |
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.
| |
Row1 |
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.
| |
Row2 |
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.
|