bevy/crates/bevy_transform/src
davier 0c374df712 Add insert_children and push_children to EntityMut (#1728)
The only API to add a parent/child relationship between existing entities is through commands, there is no easy way to do it from `World`. Manually inserting the components is not completely possible since `PreviousParent` has no public constructor.

This PR adds two methods to set entities as children of an `EntityMut`: `insert_children` and `push_children`. ~~The API is similar to the one on `Commands`, except that the parent is the `EntityMut`.~~ The API is the same as in #1703.
However, the `Parent` and `Children` components are defined in `bevy_transform` which depends on `bevy_ecs`, while `EntityMut` is defined in `bevy_ecs`, so the methods are added to the `BuildWorldChildren` trait instead.
If #1545 is merged this should be fixed too.

I'm aware cart was experimenting with entity hierarchies, but unless it's a coming soon this PR would be useful to have meanwhile.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-03-26 20:03:12 +00:00
..
components fix clippy lints (#1756) 2021-03-25 20:48:18 +00:00
hierarchy Add insert_children and push_children to EntityMut (#1728) 2021-03-26 20:03:12 +00:00
lib.rs Bevy ECS V2 (#1525) 2021-03-05 07:54:35 +00:00
transform_propagate_system.rs Make Commands and World apis consistent (#1703) 2021-03-23 00:23:40 +00:00