protected override void Initialize() { // TODO: Add your initialization logic here target = new CameraTarget(GraphicsDevice); livingRoom = new GameModel(); // Create the chase camera camera = new ChaseCamera(); // Perform an inital reset on the camera so that it starts at the resting // position. If we don't do this, the camera will start at the origin and // race across the world to get behind the chased object. // This is performed here because the aspect ratio is needed by Reset. UpdateCameraChaseTarget(); camera.Reset(); base.Initialize(); }
public void DrawMeshes(ChaseCamera Camera) { Matrix[] boneTransforms = new Matrix[Model.Bones.Count]; Model.CopyAbsoluteBoneTransformsTo(boneTransforms); foreach (ModelMesh mesh in Model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = boneTransforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) * Matrix.CreateTranslation(Position); effect.Projection = Camera.Projection; effect.View = Camera.View; } mesh.Draw(); } }
public void DrawMeshes(ChaseCamera camera) { Matrix[] transforms = new Matrix[Model.Bones.Count]; Model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in Model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) * world; // Use the matrices provided by the chase camera effect.View = camera.View; effect.Projection = camera.Projection; } mesh.Draw(); } }