A chase camera will move smoothly around a 3D object and regardless of how the camera view is changed, the camera will restore to its original position. This kind of camera is useful for a racing game or an acceleration effect. In this recipe, you will learn how to make your own chase camera in Windows Phone 7.
1. Create a Windows Phone Game in Visual Studio 2010, change the name from
Game1.cs
toChaseCameraGame.cs
. Then add thebox.fbx
3D model to the content project. After the initial work, you should insert the following code to theChaseGameCamera
class as fields:// Loading for box model Model boxModel; // Camera View and Projection matrix Matrix view; Matrix projection; // Camera's position Vector3 position; // Camera look at target Vector3 target; // Offset distance from the target. Vector3 offsetDistance; // Yaw, Pitch values float yaw; float pitch; // Angle delta for GestureType.FreeDrag Vector3 angle;
2. Instantiate the variables. Add...