O'Reilly logo

3D Programming for Windows® by Charles Petzold

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

Interactive Mouse Tracking

I first used the VisualTreeHelper.HitTest method in the TableForFour program in Chapter 3. The StatePopulationAnimator.cs and BookViewport.cs files demonstrate a simpler version of that method that doesn't require a callback function. You can use this simpler variation when you only need the topmost ModelVisual3D under a particular point.

Although the hit-testing facility in WPF 3D certainly provides you with a convenient way to determine the ModelVisual3D under the mouse pointer, it is not a general-purpose coordinate conversion. For example, if the user clicks an area of the Viewport3D where no ModelVisual3D resides, you can't determine what three-dimensional point corresponds to that click, and it's not just one point: ...

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