Open
Description
Bevy version
0.8.0
What you did
- Spawn entity from glTF scene with recognizable forward direction (e.g. character, vehicle).
- Transform the entity along the Transform::forward() direction.
- Observe model moving backward.
What you expected
Model moves forward.
What went wrong
Both Bevy and glTF use a right-handed Y-up coordinate system. They do however disagree on what direction is forward and right:
- glTF defines forward as +Z and right as -X (see https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.pdf).
- Bevy's Transform defines forward as -Z and right as +X (see https://docs.rs/bevy/latest/bevy/prelude/struct.Transform.html#method.right and https://docs.rs/bevy/latest/bevy/prelude/struct.Transform.html#method.forward).
Possible solutions
- glTF importer negates X and Z coordinates during import (breaking change for all bevy apps that use glTF import).
- Bevy Transform is changed to follow the glTF convention (breaking change for all bevy apps that use one of the Transform's direction functions).
- Bevy stops defining a forward, back, left, right direction and leaves it up to the user (e.g. by changing the forward, back, left, right functions on Transform to local_neg_z, local_z, local_x, local_neg_x).
In any case, Bevy should be consistent regarding its coordinate system. Currently, the look_at function follows the glTF convention and not the Transform's definition of forward and right (see #1153)
Metadata
Metadata
Assignees
Labels
Load files from disk to use for things like images, models, and soundsTranslations, rotations and scalesRelated to the glTF 3D scene/model formatAn unexpected or incorrect behaviorA "normal" level of difficulty; suitable for simple features or challenging fixesThis issue is ready for an implementation PR. Go for it!