June 16th, 2009
Creating a 3D cube with images in Silverlight 3All Silverlight Examples, Silverlight 3 tutorials, Silverlight C# Tutorials, Silverlight Effects, by Gavin Wignall.
In the below example I have used the new Projection properties in Silverlight 3 to create a3D cube that has a different image on each face.
The ‘how to’ bit
You can read more about using the new Projection properties in my 2 previous posts here:Controlling Projection in Silverlight 3
Using projection to build a 3D carousel in Silverlight 3 I use the same process with the 3D cube to control the movement dependant on the mouse position. To get the cube to work correctly I have had to use all three dimensions (X, Y and Z) of the projection properties. The more complicated the shape the harder it is to get all angles to move together. In the above example I have had to manipulate 12 projection values to get the cube to move correctly.
This example is still a fairly simple example of interaction, there is no reason that the images could not be updated dynamically or video be used instead. Also each image face could have it’s own navigation interface to spin to the next face.
Grab the code
As always you can grab the code for the example in this post here.