### Re: XNA Game Studio Express Discussion on the "challenges" in the tutorials?

BenFinkel

Well gosh in THAT case... :)

I created two additional Matrix variables at the class-level (class variables I don't know the correct term)

Matrix viewMatrix;

Matrix projMatrix;

And then modified the LoadGraphicsContent method to include the following loop, taken directly from the Tutorial:

//Calc the view and proj matrix

foreach (ModelMesh mesh in myModel.Meshes)

{

//This is where the mesh orientation is set, as well as our camera and projection

foreach (BasicEffect effect in mesh.Effects)

{

viewMatrix = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);

projMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),

aspectRatio, 1.0f, 10000.0f);

}

}

I left off the bit about "CopyAbsoluteBoneTransformsTo" since I didn't know if I needed to do that to calculate my view and projection matrices. Lastly, I changed the loop in the Draw method to read:

effect.View = viewMatrix;

effect.Projection = projMatrix;

instead of the code I copied up into the LoadGraphicsContent.

So, some of the questions I had:

1) Was LoadGraphicsContent the correct place to calculate those matrices

2) Did I need to do the whole mesh loop thing in the LoadGraphicsContent or just when updating the position of the model

3) Was I right to leave off the "CopyAbsoluteBoneTransformsTo" code in LoadGraphicsContent

4) Any other optimization tips, within the scope of this tutorial, I should be learning

Thanks !!