Hi all, this may seem like a simple Q and I have tried many of the solutions in the forums but none seem to work....
I've gone through the new tutorial for XNA 2.0 and have loaded and drawn the dwarf model  even got the animations running and everything.
However, I can't seem to apply a world matrix transform to it to scale and move it to fit my landscape...
As you can see from the code below, I've tried applying the worldMatrix transform in 4 places, including playerAnimator.World.
None of them have had any effect on the rendering of the dwarf...
Please help :)
Matrix
worldMatrix = Matrix.CreateScale(0.5f, 0.5f, 0.5f) *
Matrix.CreateRotationY(MathHelper.Pi)
* Matrix.CreateTranslation(new
Vector3(0, 10, 0));
view =
Matrix.CreateLookAt(cameraPosition, cameraTarget,
Vector3.Up);
Matrix projection =
Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
(float)port.Width / port.Height, .1f, 100000f);
Model model = Content.Load<Model>("dwarfmodel");
Effect myEffect = Content.Load<Effect>("skinFX");
foreach (ModelMesh
mesh in model.Meshes)
{
foreach (ModelMeshPart
part in mesh.MeshParts)
{
BasicPaletteEffect oldEffect = (BasicPaletteEffect)part.Effect;
Effect newEffect = myEffect.Clone(graphics.GraphicsDevice);
newEffect.Parameters[
"BasicTexture"].SetValue(oldEffect.Texture);
newEffect.Parameters[
"World"].SetValue(worldMatrix);
newEffect.Parameters[
"View"].SetValue(view);
newEffect.Parameters[
"Projection"].SetValue(projection);
part.Effect = newEffect;
oldEffect.Dispose();
}
}
playerAnimator =
new
ModelAnimator(this,
model);
foreach (ModelMesh
mesh in model.Meshes)
{
foreach (Effect
currentEffect in mesh.Effects)
{
if (currentEffect
is
BasicEffect)
{
BasicEffect basic = (BasicEffect)currentEffect;
playerAnimator.World = worldMatrix;
basic.World = worldMatrix;
basic.View = view;
basic.Projection = projection;
}
else
if (currentEffect
is
BasicPaletteEffect)
{
BasicPaletteEffect palette = (BasicPaletteEffect)currentEffect;
playerAnimator.World = worldMatrix;
palette.World = worldMatrix;
palette.View = view;
palette.Projection = projectionMatrix;
palette.EnableDefaultLighting();
palette.DirectionalLight0.Direction =
new
Vector3(0, 0, 1);
}
}
}
