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: ...
Get 3D Programming for Windows® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.