Skip to content

Rotate a gltf model around one axis and move it #8661

Answered by nicopap
hgeist2 asked this question in Q&A
Discussion options

You must be logged in to vote

As you know (given the code). A scene is a hierarchy of entities. In your case, you have:

  1. the root entity, the one you spawn with a SceneBundle
  2. The child cube: The entity as a "mesh", it's a collection of primitives, it is the direct child of the SceneBundle entity.
  3. The child of the child cube: The actual mesh, a single primitive, the direct child of the child cube.

Transform in bevy is inherited and accumulated by children. Meaning that if you rotate the parent, all its children will be rotated. You can see the "actual" transform of an entity by reading the GlobalTransform component. For example, if the parent has an offset of translation = Vec3::Z, and the child has an offset of trans…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hgeist2
Comment options

@nicopap
Comment options

nicopap May 24, 2023
Collaborator

Answer selected by hgeist2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
A-Scenes Serialized ECS data stored on the disk A-Transform Translations, rotations and scales
2 participants