Animating bones
With an armature loaded and our vertex skinning in place, we are now ready to playback bone animations. In this recipe, we will access the animation's keyframes that are loaded from the first animation in a mesh, and playback within a loop.
Getting ready
For this recipe, we will continue from where we left off in the Loading bones in the mesh renderer recipe.
The completed project for this recipe, called Ch04_02Animate
, is available within the companion source code provided with this book's code bundle. It is available on Packt website.
How to do it…
We will start by adding a few new properties to our mesh renderer.
- Open
MeshRenderer.cs
and add the following code:// Create and allow access to a timer System.Diagnostics.Stopwatch clock ...
Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.