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: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access