# Why does my 3D model not translate the way I expect? [closed]

In my first image, my model displays correctly:

But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground:

Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw():

cameraPosition = new Vector3(camX, camY, camZ);

// Copy any parent transforms.
Matrix[] transforms = new Matrix[mShockwave.Bones.Count];
mShockwave.CopyAbsoluteBoneTransformsTo(transforms);
Matrix[] ttransforms = new Matrix[terrain.Bones.Count];
terrain.CopyAbsoluteBoneTransformsTo(ttransforms);

// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in mShockwave.Meshes)
{
// This is where the mesh orientation is set, as well
// as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.PreferPerPixelLighting = true;
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(modelRotation)
* Matrix.CreateTranslation(modelPosition);
// Looking at the model (picture shouldnt change other than rotation)
effect.View = Matrix.CreateLookAt(cameraPosition,
modelPosition, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
1.0f, 10000.0f);
effect.TextureEnabled = true;
}

// Draw the mesh, using the effects set above.
prepare3d();
mesh.Draw();
}

//Terrain test
foreach (ModelMesh meshT in terrain.Meshes)
{

foreach (BasicEffect effect in meshT.Effects)
{
effect.EnableDefaultLighting();
effect.PreferPerPixelLighting = true;
effect.World = ttransforms[meshT.ParentBone.Index] *
Matrix.CreateRotationY(0)
* Matrix.CreateTranslation(terrainPosition);
// Looking at the model (picture shouldnt change other than rotation)
effect.View = Matrix.CreateLookAt(cameraPosition,
terrainPosition, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
1.0f, 10000.0f);
effect.TextureEnabled = true;
}

// Draw the mesh, using the effects set above.
prepare3d();
meshT.Draw();
DrawText();
}
base.Draw(gameTime);
}


I'm suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.

• Why should Y axis of model's position change if you move your model along Z axis? – snake5 Sep 6 '12 at 5:22
• snake5 I think that's the entire point of the question. Visually it looks like the Y-Axis is changing, but he isn't changing it :). – Roy T. Sep 6 '12 at 6:06
• Oh, I've got it now. Both Z and Y are changing, even though only Z is supposed to change, right? OP has some confusing wording there. In that case, I'd suggest stepping through the code with a debugger and look at the values. I'm also afraid there's too little information for us to find answers. – snake5 Sep 6 '12 at 6:39
• Forgive the "stupid human trick" questions, but... Are you sure the Z axis is forward? How are you getting the values for the text? – Fibericon Sep 10 '12 at 7:25

I had an bug in my camera. I was translating in Vector3.Up and Vector3.Right at the same time within my input class. Both were set to one thumbstick. Removing Vector3.Right from the thumbstick for movement in the cardinal directions resolved the problem.