Struct godot::prelude::Transform3D
#[repr(C)]pub struct Transform3D {
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
:
[ a.x b.x c.x o.x ]
[ a.y b.y c.y o.y ]
[ a.z b.z c.z o.z ]
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§
§impl Transform3D
impl Transform3D
pub const IDENTITY: Transform3D = _
pub const IDENTITY: Transform3D = _
The identity transform, with no translation, rotation or scaling
applied. When applied to other data structures, IDENTITY
performs no
transformation.
Godot equivalent: Transform3D.IDENTITY
pub const FLIP_X: Transform3D = _
pub const FLIP_X: Transform3D = _
Transform3D
with mirroring applied perpendicular to the YZ plane.
Godot equivalent: Transform3D.FLIP_X
pub const FLIP_Y: Transform3D = _
pub const FLIP_Y: Transform3D = _
Transform3D
with mirroring applied perpendicular to the XZ plane.
Godot equivalent: Transform3D.FLIP_Y
pub const FLIP_Z: Transform3D = _
pub const FLIP_Z: Transform3D = _
Transform3D
with mirroring applied perpendicular to the XY plane.
Godot equivalent: Transform3D.FLIP_Z
pub const fn new(basis: Basis, origin: Vector3) -> Transform3D
pub const fn new(basis: Basis, origin: Vector3) -> Transform3D
pub const fn from_cols(
a: Vector3,
b: Vector3,
c: Vector3,
origin: Vector3,
) -> Transform3D
pub const fn from_cols( a: Vector3, b: Vector3, c: Vector3, origin: Vector3, ) -> Transform3D
Create a new transform from 4 matrix-columns.
Godot equivalent: Transform3D(Vector3 x_axis, Vector3 y_axis, Vector3 z_axis, Vector3 origin)
, see Basis
for why it’s changed
pub fn from_projection(proj: &Projection) -> Transform3D
pub fn from_projection(proj: &Projection) -> Transform3D
Constructs a Transform3D
from a Projection
by trimming the last row of the projection matrix.
Godot equivalent: Transform3D(Projection from)
pub fn affine_inverse(&self) -> Transform3D
pub fn affine_inverse(&self) -> Transform3D
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
pub fn interpolate_with(&self, other: &Transform3D, weight: f32) -> Transform3D
pub fn interpolate_with(&self, other: &Transform3D, weight: f32) -> Transform3D
Returns a transform interpolated between this transform and another by a given weight (on the range of 0.0 to 1.0).
pub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if this transform is finite by calling is_finite
on the
basis and origin.
pub fn looking_at( &self, target: Vector3, up: Vector3, use_model_front: bool, ) -> Transform3D
since_api="4.1"
only.pub fn orthonormalized(&self) -> Transform3D
pub fn orthonormalized(&self) -> Transform3D
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).
Godot equivalent: Transform3D.orthonormalized()
pub fn rotated(&self, axis: Vector3, angle: f32) -> Transform3D
pub fn rotated(&self, axis: Vector3, angle: f32) -> Transform3D
Returns a copy of the transform rotated by the given angle
(in radians).
This method is an optimized version of multiplying the given transform X
with a corresponding rotation transform R
from the left, i.e., R * X
.
This can be seen as transforming with respect to the global/parent frame.
Godot equivalent: Transform2D.rotated()
pub fn rotated_local(&self, axis: Vector3, angle: f32) -> Transform3D
pub fn rotated_local(&self, axis: Vector3, angle: f32) -> Transform3D
Returns a copy of the transform rotated by the given angle
(in radians).
This method is an optimized version of multiplying the given transform X
with a corresponding rotation transform R
from the right, i.e., X * R
.
This can be seen as transforming with respect to the local frame.
Godot equivalent: Transform2D.rotated_local()
pub fn scaled(&self, scale: Vector3) -> Transform3D
pub fn scaled(&self, scale: Vector3) -> Transform3D
Returns a copy of the transform scaled by the given scale factor.
This method is an optimized version of multiplying the given transform X
with a corresponding scaling transform S
from the left, i.e., S * X
.
This can be seen as transforming with respect to the global/parent frame.
Godot equivalent: Transform2D.scaled()
pub fn scaled_local(&self, scale: Vector3) -> Transform3D
pub fn scaled_local(&self, scale: Vector3) -> Transform3D
Returns a copy of the transform scaled by the given scale factor.
This method is an optimized version of multiplying the given transform X
with a corresponding scaling transform S
from the right, i.e., X * S
.
This can be seen as transforming with respect to the local frame.
Godot equivalent: Transform2D.scaled_local()
pub fn translated(&self, offset: Vector3) -> Transform3D
pub fn translated(&self, offset: Vector3) -> Transform3D
Returns a copy of the transform translated by the given offset.
This method is an optimized version of multiplying the given transform X
with a corresponding translation transform T
from the left, i.e., T * X
.
This can be seen as transforming with respect to the global/parent frame.
Godot equivalent: Transform2D.translated()
pub fn translated_local(&self, offset: Vector3) -> Transform3D
pub fn translated_local(&self, offset: Vector3) -> Transform3D
Returns a copy of the transform translated by the given offset.
This method is an optimized version of multiplying the given transform X
with a corresponding translation transform T
from the right, i.e., X * T
.
This can be seen as transforming with respect to the local frame.
Godot equivalent: Transform2D.translated()
Trait Implementations§
§impl ApproxEq for Transform3D
impl ApproxEq for Transform3D
§fn approx_eq(&self, other: &Transform3D) -> bool
fn approx_eq(&self, other: &Transform3D) -> bool
Returns if the two transforms are approximately equal, by comparing basis
and origin
separately.
§impl Clone for Transform3D
impl Clone for Transform3D
§fn clone(&self) -> Transform3D
fn clone(&self) -> Transform3D
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for Transform3D
impl Debug for Transform3D
§impl Default for Transform3D
impl Default for Transform3D
§fn default() -> Transform3D
fn default() -> Transform3D
§impl Display for Transform3D
impl Display for Transform3D
§impl Export for Transform3D
impl Export for Transform3D
§fn default_export_info() -> PropertyHintInfo
fn default_export_info() -> PropertyHintInfo
§impl From<Basis> for Transform3D
impl From<Basis> for Transform3D
§fn from(basis: Basis) -> Transform3D
fn from(basis: Basis) -> Transform3D
Create a new transform with origin (0,0,0)
from this basis.
§impl From<Transform3D> for Projection
impl From<Transform3D> for Projection
§fn from(trans: Transform3D) -> Projection
fn from(trans: Transform3D) -> Projection
§impl FromGodot for Transform3D
impl FromGodot for Transform3D
§fn try_from_godot(
via: <Transform3D as GodotConvert>::Via,
) -> Result<Transform3D, ConvertError>
fn try_from_godot( via: <Transform3D as GodotConvert>::Via, ) -> Result<Transform3D, ConvertError>
Err
on failure.§fn from_godot(via: Self::Via) -> Self
fn from_godot(via: Self::Via) -> Self
§fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
Variant
, returning Err
on failure.§fn from_variant(variant: &Variant) -> Self
fn from_variant(variant: &Variant) -> Self
§impl GodotConvert for Transform3D
impl GodotConvert for Transform3D
§type Via = Transform3D
type Via = Transform3D
Self
is represented in Godot.§impl Mul<Aabb> for Transform3D
impl Mul<Aabb> for Transform3D
§impl Mul<Plane> for Transform3D
impl Mul<Plane> for Transform3D
§impl Mul<Vector3> for Transform3D
impl Mul<Vector3> for Transform3D
§impl Mul<f32> for Transform3D
impl Mul<f32> for Transform3D
§impl Mul for Transform3D
impl Mul for Transform3D
§type Output = Transform3D
type Output = Transform3D
*
operator.§fn mul(self, rhs: Transform3D) -> <Transform3D as Mul>::Output
fn mul(self, rhs: Transform3D) -> <Transform3D as Mul>::Output
*
operation. Read more§impl PartialEq for Transform3D
impl PartialEq for Transform3D
§fn eq(&self, other: &Transform3D) -> bool
fn eq(&self, other: &Transform3D) -> bool
self
and other
values to be equal, and is used
by ==
.§impl ToGodot for Transform3D
impl ToGodot for Transform3D
§fn to_godot(&self) -> <Transform3D as GodotConvert>::Via
fn to_godot(&self) -> <Transform3D as GodotConvert>::Via
§fn into_godot(self) -> <Transform3D as GodotConvert>::Via
fn into_godot(self) -> <Transform3D as GodotConvert>::Via
§fn to_variant(&self) -> Variant
fn to_variant(&self) -> Variant
§impl TypeStringHint for Transform3D
impl TypeStringHint for Transform3D
§fn type_string() -> String
fn type_string() -> String
§impl Var for Transform3D
impl Var for Transform3D
fn get_property(&self) -> <Transform3D as GodotConvert>::Via
fn set_property(&mut self, value: <Transform3D as GodotConvert>::Via)
fn property_hint() -> PropertyHintInfo
impl ArrayElement for Transform3D
impl Copy for Transform3D
impl GodotType for Transform3D
impl StructuralPartialEq for Transform3D
Auto Trait Implementations§
impl Freeze for Transform3D
impl RefUnwindSafe for Transform3D
impl Send for Transform3D
impl Sync for Transform3D
impl Unpin for Transform3D
impl UnwindSafe for Transform3D
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)