bevy/crates/bevy_hierarchy/src
Nicola Papale 689eab6fb7 Add an extension trait to EntityCommands to update hierarchy while preserving GlobalTransform (#7024)
# Objective

It is often necessary  to update an entity's parent
while keeping its GlobalTransform static. Currently
it is cumbersome and error-prone (two questions in
the discord `#help` channel in the past week)

- Part 2, resolves #5475
- Builds on: #7020.

## Solution

- Added the `BuildChildrenTransformExt` trait, it is part
  of `bevy::prelude` and adds the following methods to `EntityCommands`:
  - `set_parent_in_place`: Change the parent of an entity and
    update its `Transform` in order to preserve its `GlobalTransform` after the parent change
  - `remove_parent_in_place`: Remove an entity from a hierarchy,
    while preserving its `GlobalTransform`.

---

## Changelog


- Added the `BuildChildrenTransformExt` trait, it is part
  of `bevy::prelude` and adds the following methods to `EntityCommands`:
  - `set_parent_in_place`: Change the parent of an entity and
    update its `Transform` in order to preserve its `GlobalTransform` after the parent change
  - `remove_parent_in_place`: Remove an entity from a hierarchy,
    while preserving its `GlobalTransform`.

Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
2023-01-12 18:46:11 +00:00
..
components Add const Entity::PLACEHOLDER (#6761) 2022-11-28 13:40:10 +00:00
child_builder.rs Add an extension trait to EntityCommands to update hierarchy while preserving GlobalTransform (#7024) 2023-01-12 18:46:11 +00:00
events.rs Add add_child, set_parent and remove_parent to EntityMut (#6926) 2022-12-25 00:23:12 +00:00
hierarchy.rs Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
lib.rs bevy_scene: Add missing registration for SmallVec<[Entity; 8]> (#6578) 2022-11-14 23:08:23 +00:00
query_extension.rs Replace WorldQueryGats trait with actual gats (#6319) 2022-11-03 16:33:05 +00:00
valid_parent_check_plugin.rs Fix Link in valid_parent_check_plugin.rs (#6584) 2022-11-13 15:35:48 +00:00