I Get an InvalidCastException When Trying My Own Models

This is likely because you are loading a model that contains unskinned meshes, in which case BasicEffect instead of BasicPaletteEffect is used.

One way to counteract this by iterating through a model's effects in this way:

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (Effect effect in mesh.Effects)
        {
            if (Effect is BasicEffect)
            {
                BasicEffect basic = (BasicEffect)effect;
                // TODO: Add effect logic here
            }
            else if (Effect is BasicPaletteEffect)
            {
                BasicPaletteEffect palette = (BasicPaletteEffect)effect;
                // TODO: Add effect logic here
            }
        }
    }


Read here for more related information:
http://www.codeplex.com/animationcomponents/Wiki/View.aspx?title=Content%20Pipeline%20Effect%20Choosing&referringTitle=Creating%20a%20ModelAnimator

The DLL's Aren't Working!

Does your card support pixel shader 2.0?
  • The library currently requires shader 2.0. I probably won't provide support for 1.1 because that requires me to not only write a 1.1 matrix palette effect, but to also create code that splits the model up into different mesh parts that use different bones. If someone writes the code for this, I'd be glad to add it.

Have you added Animation.Content.dll to the content pipeline and Animation.dll as a reference to your project?
  • If you don't know how to do this, check out Setting Up the Project at the tutorial: Tutorial Home

Did you set your content file processor to "Model - Animation Library?"
  • If you don't know how to do this, check out Setting Up the Project at the tutorial: Tutorial Home


If you are still having problems, please post in the forums.

Last edited Mar 15, 2007 at 6:46 PM by dastle, version 7

Comments

No comments yet.