• Add this code:
    // Add this in the LoadGraphicsContent method AFTER your ModelAnimator has been created
    Effect myEffect = content.Load<Effect>("MyPaletteEffect");
    foreach (ModelMesh mesh in model.Meshes)
    {
        for (int i = 0; i < mesh.MeshParts.Count; i++)
        {
            ModelMeshPart part = mesh.MeshParts[i];
            BasicPaletteEffect effect = (BasicPaletteEffect)part.Effect;

            part.Effect = myEffect.Clone(graphics.GraphicsDevice);
            part.Effect.Parameters["BasicTexture"].SetValue(effect.Texture);
            part.Effect.Parameters["View"].SetValue(view);
            part.Effect.Parameters["Projection"].SetValue(projection);
            effect.Dispose();
        }
    }

    dwarfAnimator.InitializeEffectParams();
  • The key line is "dwarfAnimator.InitializeEffectParams();", which informs the ModelAnimator to recreate it's handles to the effect parameters.

Last edited Mar 7, 2007 at 11:40 PM by dastle, version 4

Comments

No comments yet.