diff --git a/CREDITS.md b/CREDITS.md index cc8b15083ac69..05e4dc60a1f2b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -32,7 +32,7 @@ * Epic orchestra music sample, modified to loop, from [Migfus20](https://freesound.org/people/Migfus20/sounds/560449/) ([CC BY 4.0 DEED](https://creativecommons.org/licenses/by/4.0/)) [MorphStressTest]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MorphStressTest -[fox]: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Fox +[fox]: https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/Fox [by PixelMannen]: https://opengameart.org/content/fox-and-shiba [by @tomkranis on Sketchfab]: https://sketchfab.com/models/371dea88d7e04a76af5763f2a36866bc [CC-BY 4.0]: https://creativecommons.org/licenses/by/4.0/ diff --git a/assets/models/animated/Fox.glb b/assets/models/animated/Fox.glb index 2bb946e2d4815..1ef5c0d05658c 100644 Binary files a/assets/models/animated/Fox.glb and b/assets/models/animated/Fox.glb differ diff --git a/examples/testbed/3d.rs b/examples/testbed/3d.rs index edb53a0c57377..5b35b945c5eef 100644 --- a/examples/testbed/3d.rs +++ b/examples/testbed/3d.rs @@ -282,19 +282,19 @@ mod animation { animation: Res, mut players: Query<(Entity, &mut AnimationPlayer)>, ) { - let entity = children.get(trigger.target()).unwrap()[0]; - let entity = children.get(entity).unwrap()[0]; - - let (entity, mut player) = players.get_mut(entity).unwrap(); - let mut transitions = AnimationTransitions::new(); - transitions - .play(&mut player, animation.animation, Duration::ZERO) - .seek_to(0.5) - .pause(); - - commands - .entity(entity) - .insert(AnimationGraphHandle(animation.graph.clone())) - .insert(transitions); + for child in children.iter_descendants(trigger.target()) { + if let Ok((entity, mut player)) = players.get_mut(child) { + let mut transitions = AnimationTransitions::new(); + transitions + .play(&mut player, animation.animation, Duration::ZERO) + .seek_to(0.5) + .pause(); + + commands + .entity(entity) + .insert(AnimationGraphHandle(animation.graph.clone())) + .insert(transitions); + } + } } }