Example #1
0
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Example #2
0
        public Camera(InputState input, Game1 game)
        {
            if (position == target) target.Z += 10f;

            //TODO: COMMENTS!
            this.position = new Vector3(0, 10, 75);
            this.target = new Vector3(0);

            this.device = game.GraphicsDevice;
            this.nearPlane = 0.01f;
            this.farPlane = 800f;

            this.input = input;

            // If the camera's looking straight down it has to be fixed

            while (Math.Abs(pitch) >= MathHelper.ToRadians(80))
            {
                this.position.Z += 10;
            }

            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, nearPlane, farPlane);
            view = Matrix.CreateLookAt(this.position, target, this.Up);
        }