PHP Code:
#region Variables
Model shipModel;
Vector3 cameraPosition = new Vector3(0.0f, 5000.0f, 0.0f);
Vector3 shipPosition = Vector3.Zero;
#endregion
/// <summary>
/// Draws the gameplay screen.
/// </summary>
public override void Draw(GameTime gameTime)
{
// This game has a blue background. Why? Because!
ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0);
Matrix[] transforms = new Matrix[shipModel.Bones.Count];
shipModel.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in shipModel.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(shipPosition);
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), (800.0f / 600.0f), 10.0f, 10000.0f);
}
mesh.Draw();
}
// If the game is transitioning on or off, fade it out to black.
if (TransitionPosition > 0)
ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
}
I need help on drawing mesh, I just want to make sure if this Draw() code will work...??? I used this code to just draw the model rotation, however, it doesn't appear on my game for some reason... I got some edits on it... I want it to be seen from the top instead, not really close as the sample.. Thanx if anybody could help...