Compartir a través de


Rotating the Camera with the Mouse

Possibly the most common 3D UI paradigm is to rotate an object with the mouse in order to view it from all angles.  This is illustrated by the images of the tiger model below: 

Figure 1a

Tiger model in its original configuration

Figure 1b

Tiger model after the mouse has been dragged to the left and slightly down.

This UI technique is known as a "virtual trackball" and it has been a staple of interactive computer graphics since the 80s.  It has applications ranging from CAD to department store kiosks to gaming.

To help developers working with the Windows Presentation Foundation get a jump-start using 3D in their applications I have added a sample trackball implementation to the 3DTools workspace with an accompanying article which discusses the mechanics of how a trackball works.

Reading the full article is not required to successfully use the sample code in your own applications, but skimming it might be useful.  You do not need to be a member of the workspace in order to download releases which include both binaries and source (here).