Introduction to Hit-Testing

At times you'll want to allow the user to interact with 3D objects using the mouse. The first step is a job called hit-testing. Your program obtains the two-dimensional point of the mouse and determines the object under that point. Specifically, when working with 3D visuals, your program obtains the ModelVisual3D at the mouse coordinates. More than one visual may be overlapped at that point, so you can obtain first the ModelVisual3D on the foreground at the mouse coordinates, and then the ModelVisual3D objects farther in the background. With the specific ModelVisual3D, you also obtain the GeometryModel3D, the MeshGeometry3D, the coordinates of the particular triangle, and weights that indicate the precise point within ...

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.