O'Reilly logo

3D Game Development with Microsoft Silverlight 3 Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—controlling cameras on the fly

Now, your project manager wants to view the spaceship rotating in a Silverlight application. However, as you have learned about cameras, he wants you to create the rotation effect through the camera and not by rotating the model.

Luckily, Balder offers a simple Camera class that allows us to control the position and the target without the need to make complex math calculations:

  1. Open the 3DInvadersSilverlight project.
  2. Open the code for the InvadersGame class.
  3. Add the following lines to define a private variable:
    // The camera's angle expressed in radians
    private double _cameraAngleRadians = 0;
    
  4. Replace the code that defined some properties for Camera in the LoadContent method with the following:
    // Define ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required