O'Reilly logo

Managing Data and Media in Microsoft Silverlight 4: A mashup of chapters from Packt's bestselling Silverlight books by Todd Snyder, Kevin Dockx, Gill Cleeren, 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 —displaying a 3D model in a 2D screen with WPF

The 3D digital artist is still waiting to see the spaceship from different angles. He needs to know if the model is appropriate for your game. You want to see the ship moving and rotating in the screen. In order to do this, we must add some transformations and some code to control them. We will add both XAML and C# code:

  1. Stay in the 3DInvadersXBAP project.
  2. Open the XAML code for Page1.xaml and add the following lines of code after<ModelVisual3D> (we are adding transformations for the ModelVisual3D element):
    <ModelVisual3D.Transform> <Transform3DGroup> <RotateTransform3D> <RotateTransform3D.Rotation> <AxisAngleRotation3D x:Name="rotateShip" Axis="1 0 0" Angle="100" /> </RotateTransform3D.Rotation> ...

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