To rotate a model from any direction in Windows Phone 7 could let the game player have extra choices to view the model. For programming, the trackball viewer will help the programmer to check whether the output model from the model software works well. In this recipe, you will learn how to control a model in trackball rotation.
Follow these steps to control a model in trackball rotation:
1. Create a Windows Phone Game named
ModelTrackBall
, changeGame1.cs
toModelTrackBallGame.cs
. Then add thetree.fbx
model file to the content project.2. Declare the variables for rotating and rendering the model in
ModelTrackBall
class field:// Tree model Model modelTree; // Tree model world position Matrix worldTree = Matrix.Identity; // Camera Position Vector3 cameraPosition; // Camera look at target Vector3 cameraTarget; // Camera view matrix Matrix view; // Camera projection matrix Matrix projection; // Angle for trackball rotation...