From 637b2ab84790f3413815819c31f3e8d0f8a41202 Mon Sep 17 00:00:00 2001 From: Troels Peter Jessen Date: Sat, 1 Jan 2022 21:34:02 +0100 Subject: [PATCH 1/6] Added docs for bevy_transform --- .../bevy_transform/src/components/children.rs | 2 ++ .../src/components/global_transform.rs | 3 +++ .../bevy_transform/src/components/parent.rs | 2 ++ .../src/hierarchy/child_builder.rs | 26 +++++++++++++++++++ .../bevy_transform/src/hierarchy/hierarchy.rs | 4 +++ .../hierarchy/hierarchy_maintenance_system.rs | 1 + crates/bevy_transform/src/lib.rs | 9 +++++++ 7 files changed, 47 insertions(+) diff --git a/crates/bevy_transform/src/components/children.rs b/crates/bevy_transform/src/components/children.rs index af523d77ea90d..545b1fcedf8e1 100644 --- a/crates/bevy_transform/src/components/children.rs +++ b/crates/bevy_transform/src/components/children.rs @@ -7,6 +7,7 @@ use bevy_reflect::Reflect; use smallvec::SmallVec; use std::ops::Deref; +/// Contains references to the child entities of this entity #[derive(Component, Default, Clone, Debug, Reflect)] #[reflect(Component, MapEntities)] pub struct Children(pub(crate) SmallVec<[Entity; 8]>); @@ -22,6 +23,7 @@ impl MapEntities for Children { } impl Children { + /// Builds and returns a Children component with the given entities pub fn with(entity: &[Entity]) -> Self { Self(SmallVec::from_slice(entity)) } diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index 13bdf35474318..68ad03a72399d 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -36,8 +36,11 @@ use std::ops::Mul; #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect)] #[reflect(Component, PartialEq)] pub struct GlobalTransform { + /// The position of the transform pub translation: Vec3, + /// The rotation of the transform pub rotation: Quat, + /// The scale of the transform pub scale: Vec3, } diff --git a/crates/bevy_transform/src/components/parent.rs b/crates/bevy_transform/src/components/parent.rs index 5f03dc06535c6..c436af1dc185b 100644 --- a/crates/bevy_transform/src/components/parent.rs +++ b/crates/bevy_transform/src/components/parent.rs @@ -7,6 +7,7 @@ use bevy_ecs::{ use bevy_reflect::Reflect; use std::ops::{Deref, DerefMut}; +/// Holds a reference to the parent entity of this entity, should only be present on entities that actually have a parent entity #[derive(Component, Debug, Copy, Clone, Eq, PartialEq, Reflect)] #[reflect(Component, MapEntities, PartialEq)] pub struct Parent(pub Entity); @@ -42,6 +43,7 @@ impl DerefMut for Parent { } } +/// Component that holds the parent this entity had previously #[derive(Component, Debug, Copy, Clone, Eq, PartialEq, Reflect)] #[reflect(Component, MapEntities, PartialEq)] pub struct PreviousParent(pub(crate) Entity); diff --git a/crates/bevy_transform/src/hierarchy/child_builder.rs b/crates/bevy_transform/src/hierarchy/child_builder.rs index 56f6a073d8b5b..53f754e39cc45 100644 --- a/crates/bevy_transform/src/hierarchy/child_builder.rs +++ b/crates/bevy_transform/src/hierarchy/child_builder.rs @@ -7,9 +7,12 @@ use bevy_ecs::{ }; use smallvec::SmallVec; +/// Command that adds a child to an entity #[derive(Debug)] pub struct AddChild { + /// Parent entity to add the child to pub parent: Entity, + /// Child entity to add pub child: Entity, } @@ -29,6 +32,7 @@ impl Command for AddChild { } } +/// Command that inserts a child at a given index of a parent's children, shifting following children back #[derive(Debug)] pub struct InsertChildren { parent: Entity, @@ -56,6 +60,7 @@ impl Command for InsertChildren { } } +/// Command that pushes children to the end of the entity's children #[derive(Debug)] pub struct PushChildren { parent: Entity, @@ -88,6 +93,7 @@ impl Command for PushChildren { } } +/// Command that removes children from an entity, and removes that child's parent and inserts it into the previous parent component pub struct RemoveChildren { parent: Entity, children: SmallVec<[Entity; 8]>, @@ -123,39 +129,50 @@ impl Command for RemoveChildren { } } +/// Struct for building children onto an entity pub struct ChildBuilder<'w, 's, 'a> { commands: &'a mut Commands<'w, 's>, push_children: PushChildren, } impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { + /// Spawns an entity with the given bundle and inserts it into the children defined by the ChildBuilder pub fn spawn_bundle(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn_bundle(bundle); self.push_children.children.push(e.id()); e } + /// Spawns an entity with no components and inserts in into the children defined by the ChildBuilder (adding the Parent component to it) pub fn spawn(&mut self) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn(); self.push_children.children.push(e.id()); e } + /// Returns the parent entity of this ChildBuilder pub fn parent_entity(&self) -> Entity { self.push_children.parent } + /// Adds a command to this ChildBuilder pub fn add_command(&mut self, command: C) -> &mut Self { self.commands.add(command); self } } +/// Trait defining how to build children pub trait BuildChildren { + /// Creates a ChildBuilder with the given children built in the given closure fn with_children(&mut self, f: impl FnOnce(&mut ChildBuilder)) -> &mut Self; + /// Pushes children to the back of the builder's children fn push_children(&mut self, children: &[Entity]) -> &mut Self; + /// Inserts children at the given index fn insert_children(&mut self, index: usize, children: &[Entity]) -> &mut Self; + /// Removes the given children fn remove_children(&mut self, children: &[Entity]) -> &mut Self; + /// Adds a single child fn add_child(&mut self, child: Entity) -> &mut Self; } @@ -213,6 +230,7 @@ impl<'w, 's, 'a> BuildChildren for EntityCommands<'w, 's, 'a> { } } +/// Struct for adding children to an entity directly through the World for use in exclusive systems #[derive(Debug)] pub struct WorldChildBuilder<'w> { world: &'w mut World, @@ -221,6 +239,7 @@ pub struct WorldChildBuilder<'w> { } impl<'w> WorldChildBuilder<'w> { + /// Spawns an entity with the given bundle and inserts it into the children defined by the WorldChildBuilder pub fn spawn_bundle(&mut self, bundle: impl Bundle + Send + Sync + 'static) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self @@ -240,6 +259,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } + /// Spawns an entity with no components and inserts in into the children defined by the WorldChildBuilder (adding the Parent component to it) pub fn spawn(&mut self) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self @@ -258,6 +278,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } + /// Returns the parent entity of this WorldChildBuilder pub fn parent_entity(&self) -> Entity { self.parent_entities .last() @@ -266,10 +287,15 @@ impl<'w> WorldChildBuilder<'w> { } } +/// Trait that defines adding children to an entity directly through the World pub trait BuildWorldChildren { + /// Creates a WorldChildBuilder with the given children built in the given closure fn with_children(&mut self, spawn_children: impl FnOnce(&mut WorldChildBuilder)) -> &mut Self; + /// Pushes children to the back of the builder's children fn push_children(&mut self, children: &[Entity]) -> &mut Self; + /// Inserts children at the given index fn insert_children(&mut self, index: usize, children: &[Entity]) -> &mut Self; + /// Removes the given children fn remove_children(&mut self, children: &[Entity]) -> &mut Self; } diff --git a/crates/bevy_transform/src/hierarchy/hierarchy.rs b/crates/bevy_transform/src/hierarchy/hierarchy.rs index f674ade461082..0820742c34b75 100644 --- a/crates/bevy_transform/src/hierarchy/hierarchy.rs +++ b/crates/bevy_transform/src/hierarchy/hierarchy.rs @@ -6,16 +6,19 @@ use bevy_ecs::{ }; use bevy_utils::tracing::debug; +/// Despawns the given entity and all its children recursively #[derive(Debug)] pub struct DespawnRecursive { entity: Entity, } +/// Despawns the given entity's children recursively #[derive(Debug)] pub struct DespawnChildrenRecursive { entity: Entity, } +/// Function for despawning an entity and all its children pub fn despawn_with_children_recursive(world: &mut World, entity: Entity) { // first, make the entity's own parent forget about it if let Some(parent) = world.get::(entity).map(|parent| parent.0) { @@ -61,6 +64,7 @@ impl Command for DespawnChildrenRecursive { } } +/// Trait that holds functions for despawning recursively down the transform hierarchy pub trait DespawnRecursiveExt { /// Despawns the provided entity alongside all descendants. fn despawn_recursive(self); diff --git a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs index 75b5dfc1a2f52..dbbeacab12e8f 100644 --- a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs +++ b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs @@ -8,6 +8,7 @@ use bevy_ecs::{ use bevy_utils::HashMap; use smallvec::SmallVec; +/// Updates parents when the hierarchy is changed pub fn parent_update_system( mut commands: Commands, removed_parent_query: Query<(Entity, &PreviousParent), Without>, diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index fa917bf40d889..23ca7403c8d82 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -1,9 +1,14 @@ +#![warn(missing_docs)] #![doc = include_str!("../README.md")] +/// The basic components of the transform crate pub mod components; +/// Establishing and updating the transform hierarchy pub mod hierarchy; +/// Propagating transform changes down the transform hierarchy pub mod transform_propagate_system; +#[doc(hidden)] pub mod prelude { #[doc(hidden)] pub use crate::{components::*, hierarchy::*, TransformPlugin}; @@ -13,12 +18,16 @@ use bevy_app::prelude::*; use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform}; +/// The base plugin for handling Transform components #[derive(Default)] pub struct TransformPlugin; +/// Label enum for the types of systems relating to transform #[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] pub enum TransformSystem { + /// Propagates changes in transform to childrens' global transform TransformPropagate, + /// Updates parents when changes in the hierarchy occur ParentUpdate, } From c36d8e049e7f8952e44278401578fbcf65db5cbb Mon Sep 17 00:00:00 2001 From: Troels Jessen Date: Sat, 1 Jan 2022 23:16:41 +0100 Subject: [PATCH 2/6] Update crates/bevy_transform/src/components/parent.rs Co-authored-by: KDecay --- crates/bevy_transform/src/components/parent.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_transform/src/components/parent.rs b/crates/bevy_transform/src/components/parent.rs index c436af1dc185b..c642e6bbda5cd 100644 --- a/crates/bevy_transform/src/components/parent.rs +++ b/crates/bevy_transform/src/components/parent.rs @@ -7,7 +7,8 @@ use bevy_ecs::{ use bevy_reflect::Reflect; use std::ops::{Deref, DerefMut}; -/// Holds a reference to the parent entity of this entity, should only be present on entities that actually have a parent entity +/// Holds a reference to the parent entity of this entity. +/// This component should only be present on entities that actually have a parent entity. #[derive(Component, Debug, Copy, Clone, Eq, PartialEq, Reflect)] #[reflect(Component, MapEntities, PartialEq)] pub struct Parent(pub Entity); From eb28ea4f2b3c96f2420e930c8ebc453eeab3cccc Mon Sep 17 00:00:00 2001 From: Troels Jessen Date: Sat, 1 Jan 2022 23:16:47 +0100 Subject: [PATCH 3/6] Update crates/bevy_transform/src/hierarchy/child_builder.rs Co-authored-by: KDecay --- crates/bevy_transform/src/hierarchy/child_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_transform/src/hierarchy/child_builder.rs b/crates/bevy_transform/src/hierarchy/child_builder.rs index 53f754e39cc45..bdd6620ee6020 100644 --- a/crates/bevy_transform/src/hierarchy/child_builder.rs +++ b/crates/bevy_transform/src/hierarchy/child_builder.rs @@ -143,7 +143,7 @@ impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { e } - /// Spawns an entity with no components and inserts in into the children defined by the ChildBuilder (adding the Parent component to it) + /// Spawns an [`Entity`] with no components and inserts it into the children defined by the ChildBuilder which adds the [`Parent`] component to it. pub fn spawn(&mut self) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn(); self.push_children.children.push(e.id()); From 1ac37cfa156f2931fc1879249bbc117448a3ac0e Mon Sep 17 00:00:00 2001 From: Troels Jessen Date: Sat, 1 Jan 2022 23:16:52 +0100 Subject: [PATCH 4/6] Update crates/bevy_transform/src/hierarchy/child_builder.rs Co-authored-by: KDecay --- crates/bevy_transform/src/hierarchy/child_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_transform/src/hierarchy/child_builder.rs b/crates/bevy_transform/src/hierarchy/child_builder.rs index bdd6620ee6020..469cd59897ba5 100644 --- a/crates/bevy_transform/src/hierarchy/child_builder.rs +++ b/crates/bevy_transform/src/hierarchy/child_builder.rs @@ -259,7 +259,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } - /// Spawns an entity with no components and inserts in into the children defined by the WorldChildBuilder (adding the Parent component to it) + /// Spawns an [`Entity`] with no components and inserts it into the children defined by the WorldChildBuilder which adds the [`Parent`] component to it. pub fn spawn(&mut self) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self From 833d0b4d2c7ee2ca4e7649c47b279680a3151455 Mon Sep 17 00:00:00 2001 From: Troels Peter Jessen Date: Sun, 2 Jan 2022 13:25:09 +0100 Subject: [PATCH 5/6] Added linking to transform doc --- .../bevy_transform/src/components/children.rs | 2 +- .../bevy_transform/src/components/parent.rs | 2 +- .../src/hierarchy/child_builder.rs | 22 +++++++++---------- crates/bevy_transform/src/lib.rs | 6 ++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/bevy_transform/src/components/children.rs b/crates/bevy_transform/src/components/children.rs index 545b1fcedf8e1..96097a1da8a59 100644 --- a/crates/bevy_transform/src/components/children.rs +++ b/crates/bevy_transform/src/components/children.rs @@ -23,7 +23,7 @@ impl MapEntities for Children { } impl Children { - /// Builds and returns a Children component with the given entities + /// Builds and returns a [`Children`] component with the given entities pub fn with(entity: &[Entity]) -> Self { Self(SmallVec::from_slice(entity)) } diff --git a/crates/bevy_transform/src/components/parent.rs b/crates/bevy_transform/src/components/parent.rs index c436af1dc185b..5d08eca23b5c4 100644 --- a/crates/bevy_transform/src/components/parent.rs +++ b/crates/bevy_transform/src/components/parent.rs @@ -43,7 +43,7 @@ impl DerefMut for Parent { } } -/// Component that holds the parent this entity had previously +/// Component that holds the [`Parent`] this entity had previously #[derive(Component, Debug, Copy, Clone, Eq, PartialEq, Reflect)] #[reflect(Component, MapEntities, PartialEq)] pub struct PreviousParent(pub(crate) Entity); diff --git a/crates/bevy_transform/src/hierarchy/child_builder.rs b/crates/bevy_transform/src/hierarchy/child_builder.rs index 53f754e39cc45..651fd52ace8a6 100644 --- a/crates/bevy_transform/src/hierarchy/child_builder.rs +++ b/crates/bevy_transform/src/hierarchy/child_builder.rs @@ -136,26 +136,26 @@ pub struct ChildBuilder<'w, 's, 'a> { } impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { - /// Spawns an entity with the given bundle and inserts it into the children defined by the ChildBuilder + /// Spawns an entity with the given bundle and inserts it into the children defined by the [`ChildBuilder`] pub fn spawn_bundle(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn_bundle(bundle); self.push_children.children.push(e.id()); e } - /// Spawns an entity with no components and inserts in into the children defined by the ChildBuilder (adding the Parent component to it) + /// Spawns an entity with no components and inserts in into the children defined by the [`ChildBuilder`] (adding the [`Parent`] component to it) pub fn spawn(&mut self) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn(); self.push_children.children.push(e.id()); e } - /// Returns the parent entity of this ChildBuilder + /// Returns the parent entity of this [`ChildBuilder`] pub fn parent_entity(&self) -> Entity { self.push_children.parent } - /// Adds a command to this ChildBuilder + /// Adds a command to this [`ChildBuilder`] pub fn add_command(&mut self, command: C) -> &mut Self { self.commands.add(command); self @@ -164,7 +164,7 @@ impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { /// Trait defining how to build children pub trait BuildChildren { - /// Creates a ChildBuilder with the given children built in the given closure + /// Creates a [`ChildBuilder`] with the given children built in the given closure fn with_children(&mut self, f: impl FnOnce(&mut ChildBuilder)) -> &mut Self; /// Pushes children to the back of the builder's children fn push_children(&mut self, children: &[Entity]) -> &mut Self; @@ -230,7 +230,7 @@ impl<'w, 's, 'a> BuildChildren for EntityCommands<'w, 's, 'a> { } } -/// Struct for adding children to an entity directly through the World for use in exclusive systems +/// Struct for adding children to an entity directly through the [`World`] for use in exclusive systems #[derive(Debug)] pub struct WorldChildBuilder<'w> { world: &'w mut World, @@ -239,7 +239,7 @@ pub struct WorldChildBuilder<'w> { } impl<'w> WorldChildBuilder<'w> { - /// Spawns an entity with the given bundle and inserts it into the children defined by the WorldChildBuilder + /// Spawns an entity with the given bundle and inserts it into the children defined by the [`WorldChildBuilder`] pub fn spawn_bundle(&mut self, bundle: impl Bundle + Send + Sync + 'static) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self @@ -259,7 +259,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } - /// Spawns an entity with no components and inserts in into the children defined by the WorldChildBuilder (adding the Parent component to it) + /// Spawns an entity with no components and inserts in into the children defined by the [`WorldChildBuilder`] (adding the [`Parent`] component to it) pub fn spawn(&mut self) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self @@ -278,7 +278,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } - /// Returns the parent entity of this WorldChildBuilder + /// Returns the parent entity of this [`WorldChildBuilder`] pub fn parent_entity(&self) -> Entity { self.parent_entities .last() @@ -287,9 +287,9 @@ impl<'w> WorldChildBuilder<'w> { } } -/// Trait that defines adding children to an entity directly through the World +/// Trait that defines adding children to an entity directly through the [`World`] pub trait BuildWorldChildren { - /// Creates a WorldChildBuilder with the given children built in the given closure + /// Creates a [`WorldChildBuilder`] with the given children built in the given closure fn with_children(&mut self, spawn_children: impl FnOnce(&mut WorldChildBuilder)) -> &mut Self; /// Pushes children to the back of the builder's children fn push_children(&mut self, children: &[Entity]) -> &mut Self; diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 23ca7403c8d82..d9ddf29507078 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -18,16 +18,16 @@ use bevy_app::prelude::*; use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform}; -/// The base plugin for handling Transform components +/// The base plugin for handling [`Transform`] components #[derive(Default)] pub struct TransformPlugin; /// Label enum for the types of systems relating to transform #[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] pub enum TransformSystem { - /// Propagates changes in transform to childrens' global transform + /// Propagates changes in transform to childrens' [`GlobalTransform`] TransformPropagate, - /// Updates parents when changes in the hierarchy occur + /// Updates [`Parent`] when changes in the hierarchy occur ParentUpdate, } From 169846a1fa07a7300dbcd700f6b8d327be13a281 Mon Sep 17 00:00:00 2001 From: Troels Peter Jessen Date: Sun, 2 Jan 2022 13:30:44 +0100 Subject: [PATCH 6/6] Clarified global transform docs and updated linking in docs --- .../src/components/global_transform.rs | 6 +++--- crates/bevy_transform/src/hierarchy/child_builder.rs | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index 68ad03a72399d..aab8142dcc3a8 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -36,11 +36,11 @@ use std::ops::Mul; #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect)] #[reflect(Component, PartialEq)] pub struct GlobalTransform { - /// The position of the transform + /// The position of the global transform pub translation: Vec3, - /// The rotation of the transform + /// The rotation of the global transform pub rotation: Quat, - /// The scale of the transform + /// The scale of the global transform pub scale: Vec3, } diff --git a/crates/bevy_transform/src/hierarchy/child_builder.rs b/crates/bevy_transform/src/hierarchy/child_builder.rs index 5cfb7d3c15707..3dd47da3878a6 100644 --- a/crates/bevy_transform/src/hierarchy/child_builder.rs +++ b/crates/bevy_transform/src/hierarchy/child_builder.rs @@ -143,11 +143,7 @@ impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> { e } -<<<<<<< HEAD - /// Spawns an entity with no components and inserts in into the children defined by the [`ChildBuilder`] (adding the [`Parent`] component to it) -======= - /// Spawns an [`Entity`] with no components and inserts it into the children defined by the ChildBuilder which adds the [`Parent`] component to it. ->>>>>>> 1ac37cfa156f2931fc1879249bbc117448a3ac0e + /// Spawns an [`Entity`] with no components and inserts it into the children defined by the [`ChildBuilder`] which adds the [`Parent`] component to it. pub fn spawn(&mut self) -> EntityCommands<'w, 's, '_> { let e = self.commands.spawn(); self.push_children.children.push(e.id()); @@ -263,11 +259,7 @@ impl<'w> WorldChildBuilder<'w> { self.world.entity_mut(entity) } -<<<<<<< HEAD - /// Spawns an entity with no components and inserts in into the children defined by the [`WorldChildBuilder`] (adding the [`Parent`] component to it) -======= - /// Spawns an [`Entity`] with no components and inserts it into the children defined by the WorldChildBuilder which adds the [`Parent`] component to it. ->>>>>>> 1ac37cfa156f2931fc1879249bbc117448a3ac0e + /// Spawns an [`Entity`] with no components and inserts it into the children defined by the [`WorldChildBuilder`] which adds the [`Parent`] component to it. pub fn spawn(&mut self) -> EntityMut<'_> { let parent_entity = self.parent_entity(); let entity = self