Trackball |
Trackball is a utility class which observes the mouse events on a specified FrameworkElement and produces a Transform3D with the resultant rotation and scale. Example Usage: Trackball trackball = new Trackball(); trackball.EventSource = myElement; myViewport3D.Camera.Transform = trackball.Transform; Because Viewport3Ds only raise events when the mouse is over the rendered 3D geometry (as opposed to not when the mouse is within the layout bounds) you usually want to use another element as your EventSource. For example, a transparent border placed on top of your Viewport3D works well: NOTE: The Transform property may be shared by multiple Cameras if you want to have auxiliary views following the trackball. It can also be useful to share the Transform property with models in the scene that you want to move with the camera. (For example, the Trackport3D's headlight is implemented this way.) You may also use a Transform3DGroup to combine the Transform property with additional Transforms. |