First, a quick definition, if you are new to game development:
a Transform is what allows you to place an object in the game world. It is a combination of the object's "translation" (position/coordinates), "rotation", and "scale" (size adjustment).
You move objects around by modifying the translation, rotate them by modifying the rotation, and make them larger or smaller by modifying the scale.
In Bevy, transforms are represented by two components:
Any Entity that represents an object in the game world
needs to have both. All of Bevy's bundle types
include them. If you are creating a custom entity, you can use
TransformBundle to ensure you don't miss them.
GlobalTransform represents the absolute global
position in the world. If the entity does not have a parent, then this will
have the same value as the
Transform. The value of
GlobalTransform is calculated/managed internally
by Bevy. You should treat it as read-only; do not mutate it.
Beware: The two components are synchronized by a bevy-internal system
(the "transform propagation system"), which runs in the
stage. This is somewhat finnicky and can result in tricky pitfalls
if you are trying to do advanced things that rely on both the relative/local
and the absolute/global transforms of entities. When you mutate the
is not updated immediately. They will be out-of-sync until the transform
propagation system runs.