We could use the Model class and render in the Draw method as described in the XNA documentation examples, but lets speed things up and just use the model animator to view it (even though it is not animated).
  • Set the processor for flat.x to "Model - Animation Library"
  • Create a member variable to store the new ModelAnimator
  • Load the model and create the animator
  • Because the "flat.x" model is not skinned, it uses BasicEffect.
  • Using the view/projection matrices you made earlier (in the first ModelAnimator creation section), initialize the effects.
  • Set the world matrix in your ground ModelAnimator to Matrix.CreateScale(10,1,10) so that it is sufficiently large.
  • Here is the code:
   // Add this as a member variable
   ModelAnimator ground;

    // Add this in LoadGraphicsContent
    Model groundModel = content.Load<Model>("flat");
    ground = new ModelAnimator(this, groundModel);
    foreach (ModelMesh mesh in groundModel.Meshes)
        foreach (BasicEffect effect in mesh.Effects)
            effect.View = view;
            effect.Projection = projection;
    ground.World =  Matrix.CreateScale(10, 1, 10);

Last edited Mar 7, 2007 at 8:50 PM by dastle, version 4


No comments yet.