#How to play animation for specific entity?

3 messages · Page 1 of 1 (latest)

grave fog
#

For example I have a SceneBundle with Rotatable component and I need play animation for only this entity.

velvet hull
#
        // Get the animation controller component, which is a child of the player entity.
        let mut iter = animation_query
            .iter_many_mut(hierarchy_query.iter_descendants(entity));
        let animation_player = iter.fetch_next();
        let Some(mut animation_player) = animation_player else {
            return;
        };

        animation_player.play(...);

Where:

    animation_query: Query<&mut AnimationPlayer>,
    hierarchy_query: Query<&Children>,