AnimationTarget

AnimationTarget

  • id : bevy_animation::AnimationTargetId
  • player : bevy_ecs::entity::Entity

Description

An entity that can be animated by an [AnimationPlayer].

These are frequently referred to as bones or joints, because they often refer to individually-animatable parts of an armature.

Asset loaders for armatures are responsible for adding these as necessary. Typically, they're generated from hashed versions of the entire name path from the root of the armature to the bone. See the [AnimationTargetId] documentation for more details.

By convention, asset loaders add [AnimationTarget] components to the descendants of an [AnimationPlayer], as well as to the [AnimationPlayer] entity itself, but Bevy doesn't require this in any way. So, for example, it's entirely possible for an [AnimationPlayer] to animate a target that it isn't an ancestor of. If you add a new bone to or delete a bone from an armature at runtime, you may want to update the [AnimationTarget] component as appropriate, as Bevy won't do this automatically.

Note that each entity can only be animated by one animation player at a time. However, you can change [AnimationTarget]'s player property at runtime to change which player is responsible for animating the entity.

Functions