Time for action – beginning the Camera class
1. Add a new class to the Cube Chaser project by right-clicking on the project in Solution Explorer and selecting Add | Class....
2. Ensure that the Visual C# | Code is selected under Installed Templates and select the Class template.
3. Enter
Camera.cs
as the name of the class file.4. Add the following
using
directive to the top of theCamera.cs
file:using Microsoft.Xna.Framework;
5. Add the following fields and properties to the
Camera
class:#region Fields private Vector3 position = Vector3.Zero; private float rotation; #endregion #region Properties public Matrix Projection { get; private set; } #endregion
6. Add a constructor for the
Camer
a
class:#region Constructor public Camera( Vector3 position, float rotation, float aspectRatio, float nearClip, float farClip) { Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, aspectRatio, nearClip, farClip); MoveTo(position...