This project is read-only.
The Animation Library allows you to specify the local transform to use for any bone. As an example, let's make the dwarf hold his weapon upside down.
  • To get a reference to the BonePose, which is named weapon, use
  • Set the CurrentAnimation to null. This will make the bone use the DefaultTransform property for rendering.
  • We want the translation component of our new matrix to be equal to the original translation so it looks like he is holding his weapon.
  • To turn the weapon upside down, rotate it by PI radians on the X axis and then by PI radians on the Y axis
  • Here is the code:
    BonePose weapon = dwarfAnimator.BonePoses["weapon"];
    weapon.CurrentAnimation = null;
    weapon.CurrentBlendAnimation = null;
    weapon.DefaultTransform =
        Matrix.CreateRotationX(MathHelper.Pi) * 
        Matrix.CreateRotationY(MathHelper.Pi) *
  • Setting the Blend Animation to null is optional at the moment, but I put it in for a safety check for when we get to animation blending later.

Last edited Feb 14, 2007 at 3:31 AM by dastle, version 5


No comments yet.