 dfdf2b9ea4
			
		
	
	
		dfdf2b9ea4
		
			
		
	
	
	
	
		
			
			This is an implementation of RFC #51: https://github.com/bevyengine/rfcs/blob/main/rfcs/51-animation-composition.md Note that the implementation strategy is different from the one outlined in that RFC, because two-phase animation has now landed. # Objective Bevy needs animation blending. The RFC for this is [RFC 51]. ## Solution This is an implementation of the RFC. Note that the implementation strategy is different from the one outlined there, because two-phase animation has now landed. This is just a draft to get the conversation started. Currently we're missing a few things: - [x] A fully-fleshed-out mechanism for transitions - [x] A serialization format for `AnimationGraph`s - [x] Examples are broken, other than `animated_fox` - [x] Documentation --- ## Changelog ### Added * The `AnimationPlayer` has been reworked to support blending multiple animations together through an `AnimationGraph`, and as such will no longer function unless a `Handle<AnimationGraph>` has been added to the entity containing the player. See [RFC 51] for more details. * Transition functionality has moved from the `AnimationPlayer` to a new component, `AnimationTransitions`, which works in tandem with the `AnimationGraph`. ## Migration Guide * `AnimationPlayer`s can no longer play animations by themselves and need to be paired with a `Handle<AnimationGraph>`. Code that was using `AnimationPlayer` to play animations will need to create an `AnimationGraph` asset first, add a node for the clip (or clips) you want to play, and then supply the index of that node to the `AnimationPlayer`'s `play` method. * The `AnimationPlayer::play_with_transition()` method has been removed and replaced with the `AnimationTransitions` component. If you were previously using `AnimationPlayer::play_with_transition()`, add all animations that you were playing to the `AnimationGraph`, and create an `AnimationTransitions` component to manage the blending between them. [RFC 51]: https://github.com/bevyengine/rfcs/blob/main/rfcs/51-animation-composition.md --------- Co-authored-by: Rob Parrett <robparrett@gmail.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			846 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			846 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| (
 | |
|     graph: (
 | |
|         nodes: [
 | |
|             (
 | |
|                 clip: None,
 | |
|                 weight: 1.0,
 | |
|             ),
 | |
|             (
 | |
|                 clip: None,
 | |
|                 weight: 0.5,
 | |
|             ),
 | |
|             (
 | |
|                 clip: Some(AssetPath("models/animated/Fox.glb#Animation0")),
 | |
|                 weight: 1.0,
 | |
|             ),
 | |
|             (
 | |
|                 clip: Some(AssetPath("models/animated/Fox.glb#Animation1")),
 | |
|                 weight: 1.0,
 | |
|             ),
 | |
|             (
 | |
|                 clip: Some(AssetPath("models/animated/Fox.glb#Animation2")),
 | |
|                 weight: 1.0,
 | |
|             ),
 | |
|         ],
 | |
|         node_holes: [],
 | |
|         edge_property: directed,
 | |
|         edges: [
 | |
|             Some((0, 1, ())),
 | |
|             Some((0, 2, ())),
 | |
|             Some((1, 3, ())),
 | |
|             Some((1, 4, ())),
 | |
|         ],
 | |
|     ),
 | |
|     root: 0,
 | |
| ) |