## What problem does this solve or what need does it fill? It is currently cumbersome and error-prone to update an entity's parent while keeping its `GlobalTransform` static. ## What solution would you like? I'd like a method on `EntityCommands` that allows updating both the parent and the transform of an entity so that they keep their `GlobalTransform`. ## What alternative(s) have you considered? It is possible to reparent keeping the same transform with the following code: ```rust fn transform_relative_to(point: &GlobalTransform, reference: &GlobalTransform) -> Transform { let relative_affine = reference.affine().inverse() * point.affine(); let (scale, rotation, translation) = relative_affine.to_scale_rotation_translation(); Transform { translation, rotation, scale } } ``` Then, the following to set both the parent and the transform in order to preserve the same `GlobalTransform` through the hierarchy change. ```rust let new_transform = transform_relative_to(entity_transform, parent_transform); commands.entity(entity).set_parent(new_parent).insert(new_transform); ```
Activity
[-]Add more commands to deal with hierarchy[/-][+]Add Transform-preserving hierarchy update method[/+]Add a reparented_to method to `GlobalTransform` (#7020)
Add a reparented_to method to `GlobalTransform` (#7020)
Add an extension trait to `EntityCommands` to update hierarchy while …
Add an extension trait to `EntityCommands` to update hierarchy while …
Add a reparented_to method to `GlobalTransform` (bevyengine#7020)
Add an extension trait to `EntityCommands` to update hierarchy while …
Add a reparented_to method to `GlobalTransform` (bevyengine#7020)
Add an extension trait to `EntityCommands` to update hierarchy while …