diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 6494f7b2ba332..e1432d0305aa4 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -602,7 +602,7 @@ pub fn advance_animations( /// according to the currently-playing animation. pub fn animate_targets( clips: Res>, - players: Query<&AnimationPlayer, Without>, + players: Query<&AnimationPlayer>, mut targets: Query<( Entity, &AnimationTarget, diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 8007b0644af2c..f6946df688dff 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -952,10 +952,15 @@ fn load_node( None => { if animation_roots.contains(&gltf_node.index()) { // This is an animation root. Make a new animation context. - animation_context = Some(AnimationContext { + let new_animation_context = AnimationContext { root: node.id(), path: smallvec![name], + }; + node.insert(AnimationTarget { + id: AnimationTargetId::from_names(new_animation_context.path.iter()), + player: new_animation_context.root, }); + animation_context = Some(new_animation_context) } } Some(ref mut animation_context) => {