The Animation Library provides the ModelViewer class to help you quickly view your animated models. It works very similar to the directx mesh viewer.
  • Unlike the ModelAnimator, the ModelViewer object uses its own view and projection matrices.
  • Create an instance of the ModelViewer using the dwarf model (you might want to disable dwarfAnimator temporarily)
  • Run the idle animation as described in the previous tutorial section. You can access the viewer's animators via the ModelViewer.Animators property. The dwarf animator will be at index 0:
    // Add this to LoadGraphicsContent after temporarily disabling dwarfAnimator
    ModelViewer viewer = new ModelViewer(this, model);
    ModelAnimator animator = viewer.Animators;
    RunController(animator, idle);
  • To rotate the model, click and drag the left mouse button.
  • To rotate the camera around the model (and see the lighting), click and drag the right mouse button.
  • To zoom in and out, use the mouse wheel.

Last edited Mar 17, 2008 at 7:36 AM by dastle, version 5


Catalyst Oct 2, 2007 at 6:51 PM 
Change this line:
ModelAnimator animator = viewer.Animators[0];

To this:
ModelAnimator animator = viewer.Animator;

EdificeOrifice Sep 6, 2007 at 3:16 PM 
Error: 'Xclna.Xna.Animation.ModelViewer' does not contain a definition for 'Animators'

robin101 Jun 19, 2007 at 7:51 AM 
Hey it'don't work...