GlobalTransform

GlobalTransform

  1. glam::Affine3A

Description

[GlobalTransform] is an affine transformation from entity-local coordinates to worldspace coordinates.

You cannot directly mutate [GlobalTransform]; instead, you change an entity's transform by manipulating its [Transform], which indirectly causes Bevy to update its [GlobalTransform].

  • To get the global transform of an entity, you should get its [GlobalTransform].
  • For transform hierarchies to work correctly, you must have both a [Transform] and a [GlobalTransform].
    • You may use the TransformBundle to guarantee this. TransformBundle is now deprecated. [GlobalTransform] is automatically inserted whenever [Transform] is inserted.

[Transform] and [GlobalTransform]

[Transform] transforms an entity relative to its parent's reference frame, or relative to world space coordinates, if it doesn't have a Parent.

[GlobalTransform] is managed by Bevy; it is computed by successively applying the [Transform] of each ancestor entity which has a Transform. This is done automatically by Bevy-internal systems in the system set TransformPropagate.

This system runs during PostUpdate. If you update the [Transform] of an entity in this schedule or after, you will notice a 1 frame lag before the [GlobalTransform] is updated.

Examples

Functions

FunctionSummary
affine(_self) Returns the 3d affine transformation matrix as an [`Affine3A`].
back(_self)Return the local back vector (Z).
clone(_self)No Documentation 🚧
compute_matrix(_self) Returns the 3d affine transformation matrix as a [`Mat4`].
compute_transform(_self) Returns the transformation as a [`Transform`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid.
down(_self)Return the local down vector (-Y).
eq(_self, other)No Documentation 🚧
forward(_self)Return the local forward vector (-Z).
from_isometry(iso)No Documentation 🚧
from_rotation(rotation)No Documentation 🚧
from_scale(scale)No Documentation 🚧
from_translation(translation)No Documentation 🚧
from_xyz(x, y, z)No Documentation 🚧
left(_self)Return the local left vector (-X).
mul(_self, value)No Documentation 🚧
mul-1(arg0, arg1)No Documentation 🚧
mul-2(arg0, arg1)No Documentation 🚧
mul_transform(_self, transform) Multiplies `self` with `transform` component by component, returning the resulting [`GlobalTransform`]
radius_vec3a(_self, extents) Get an upper bound of the radius from the given `extents`.
reparented_to(_self, parent) Returns the [`Transform`] `self` would have if it was a child of an entity with the `parent` [`GlobalTransform`
right(_self)Return the local right vector (X).
rotation(_self) Get the rotation as a [`Quat`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. # Warning This is calculated using `to_scale_rotation_translation`, meaning that you should probably use it directly if you also need translation or scale.
scale(_self) Get the scale as a [`Vec3`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. Some of the computations overlap with `to_scale_rotation_translation`, which means you should use it instead if you also need rotation.
to_isometry(_self) Returns the isometric part of the transformation as an [isometry]. Any scaling done by the transformation will be ignored. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. [isometry]
transform_point(_self, point) Transforms the given point from local space to global space, applying shear, scale, rotation and tr
translation(_self) Get the translation as a [`Vec3`].
translation_vec3a(_self) Get the translation as a [`Vec3A`].
up(_self)Return the local up vector (Y).