Implement gltf animation loading, playback example #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Solution
bevy_gltf/src/animation.rsto hold all the animation-related structs to hold the data that can be pulled from thegltfcrate json data. This addsGltfAnimationand its children: Channels, Samplers, and the like.GltfAnimTargetInfocomponents to any target entities in Gltf Scenes.GltfAnimTargetInfocontains a reference to the Gltf handle that spawned it, and all of the animation+channel pairs that target that entity's transform.gltf_skinned_mesh_using_animation_datacontains an exampleGltfAnimationControllerand the necessary general infrastructure that enables a generalizedupdate_gltf_animationssystem.@Looooong's gltf_skinned_mesh example replicates the glTF SimpleSkin tutorial scene, except for the animation part. The new example replicates the same scene using the animation data in the gltf in combination with general purpose animation controller code.
The reason I'm including a lot of "generalized" animation code in the example is to allow people to make full use of glTF model animations in their own Bevy projects without needing a fully general-purpose animation system to be built. I'm submitting this PR as a port from a personal project that just patches @Looooong's skinned mesh feature on top of Bevy 0.5, so even though this example doesn't make use of animation blending, the animation controller code handles animation blending (mostly) fine: