pub trait BuildChildrenTransformExt {
// Required methods
fn set_parent_in_place(&mut self, parent: Entity) -> &mut Self;
fn remove_parent_in_place(&mut self) -> &mut Self;
}
bevy-support
only.Expand description
Collection of methods similar to the built-in parenting methods on EntityWorldMut
and EntityCommands
, but preserving each
entity’s GlobalTransform
.
Required Methods§
Sourcefn set_parent_in_place(&mut self, parent: Entity) -> &mut Self
fn set_parent_in_place(&mut self, parent: Entity) -> &mut Self
Change this entity’s parent while preserving this entity’s GlobalTransform
by updating its Transform
.
Insert the ChildOf
component directly if you don’t want to also update the Transform
.
Note that both the hierarchy and transform updates will only execute
the next time commands are applied
(during ApplyDeferred
).
Sourcefn remove_parent_in_place(&mut self) -> &mut Self
fn remove_parent_in_place(&mut self) -> &mut Self
Make this entity parentless while preserving this entity’s GlobalTransform
by updating its Transform
to be equal to its current GlobalTransform
.
See EntityWorldMut::remove_parent
or EntityCommands::remove_parent
for a method that doesn’t update the Transform
.
Note that both the hierarchy and transform updates will only execute
the next time commands are applied
(during ApplyDeferred
).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.