@@ -512,7 +512,7 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
512
512
self
513
513
}
514
514
515
- /// Moves a [`Bundle`] from the entity to another .
515
+ /// Moves a [`Bundle`] to a target entity .
516
516
///
517
517
/// # Example
518
518
///
@@ -552,7 +552,7 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
552
552
self
553
553
}
554
554
555
- /// Moves a [`Component`] from the entity to another .
555
+ /// Moves a [`Component`] to a target entity .
556
556
///
557
557
/// # Example
558
558
///
@@ -575,6 +575,32 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
575
575
self . move_bundle_to :: < ( C , ) > ( target)
576
576
}
577
577
578
+ /// Moves a [`Bundle`] from a source entity.
579
+ ///
580
+ /// See [`move_bundle_to`](EntityCommands::move_bundle_to).
581
+ pub fn move_bundle_from < T : Bundle > ( & mut self , source : Entity ) -> & mut Self {
582
+ assert ! (
583
+ self . commands. entities. contains( self . entity) ,
584
+ "Attempting to move bundle {:?} from entity {:?} to entity {:?}, which doesn't exist." ,
585
+ std:: any:: type_name:: <T >( ) ,
586
+ source,
587
+ self . entity
588
+ ) ;
589
+ self . commands . add ( MoveBundleTo :: < T > {
590
+ source,
591
+ target : self . entity ,
592
+ _bundle : PhantomData ,
593
+ } ) ;
594
+ self
595
+ }
596
+
597
+ /// Moves a [`Component`] from a source entity.
598
+ ///
599
+ /// See [`move_to`](EntityCommands::move_to).
600
+ pub fn move_from < C : Component > ( & mut self , source : Entity ) -> & mut Self {
601
+ self . move_bundle_from :: < ( C , ) > ( source)
602
+ }
603
+
578
604
/// Despawns the entity.
579
605
///
580
606
/// See [`World::despawn`] for more details.
0 commit comments