#[repr(C)]
pub struct Transform { pub basis: Basis, pub origin: Vector3, }
Expand description

Affine 3D transform (3x4 matrix).

Used for 3D linear transformations. Uses a basis + origin representation.

Expressed as a 3x4 matrix, this transform consists of 3 basis (column) vectors a, b, c as well as an origin o; more information in Self::from_basis_origin():

[ a.x  b.x  c.x  o.x ]
[ a.y  b.y  c.y  o.y ]
[ a.z  b.z  c.z  o.z ]

See also Transform in the Godot API doc.

Fields

basis: Basis

The basis is a matrix containing 3 vectors as its columns. They can be interpreted as the basis vectors of the transformed coordinate system.

origin: Vector3

The new origin of the transformed coordinate system.

Implementations

Identity transform; leaves objects unchanged when applied.

Transform that mirrors along the X axis (perpendicular to the YZ plane).

Transform that mirrors along the Y axis (perpendicular to the XZ plane).

Transform that mirrors along the Z axis (perpendicular to the XY plane).

Creates a new transform from three basis vectors and the coordinate system’s origin.

Each vector represents a basis vector in the transformed coordinate system. For example, a is the result of transforming the X unit vector (1, 0, 0). The 3 vectors need to be linearly independent.

Basis vectors are stored as column vectors in the matrix, see also Basis::from_basis_vectors().

The construction Transform::from_basis_origin(a, b, c, o) will create the following 3x4 matrix:

[ a.x  b.x  c.x  o.x ]
[ a.y  b.y  c.y  o.y ]
[ a.z  b.z  c.z  o.z ]

Returns this transform, with its origin moved by a certain translation

Returns a vector transformed (multiplied) by the matrix.

Returns a vector transformed (multiplied) by the transposed basis matrix.

Note: This results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.

Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).

Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.

Returns a copy of the transform rotated such that its -Z axis points towards the target position.

The transform will first be rotated around the given up vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the target and up vectors.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
A type-specific hint type that is valid for the type being exported. Read more
Returns ExportInfo given an optional typed hint.
The resulting type after applying the * operator.
Performs the * operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.