开发者

Hit Test WPF 3D Model parts

开发者 https://www.devze.com 2023-03-17 11:19 出处:网络
I have a big ModelVisual3D (e.g. car) which is divided into many smaller GeometryModel3D objects (e.g. tyres, seats, wheels, etc.).

I have a big ModelVisual3D (e.g. car) which is divided into many smaller GeometryModel3D objects (e.g. tyres, seats, wheels, etc.).

I would like to hit test the ModelVisual3D when the mouse is clicked and determine which GeometryModel3D was hit. I can hit test my car (the ModelVisual3D) but cannot determine which part of the car (the 开发者_Go百科GeometryModel3D objects) was clicked.

Does anybody have an idea how I can determine the exact part of my model when handling a MouseLeftButtonDown event (or any other Mouse event)?


Have a look at http://www.kindohm.com/technical/ComplexVisuals.htm - I believe the mechanisms explained there will help.


This blog post shows how to do ray testing with the framework:

http://blogs.msdn.com/b/wpf3d/archive/2009/05/18/3d-hit-testing.aspx

The result in the callback has detail on the intersected mesh from which you can get the specific part of the mesh which was intersected.

0

精彩评论

暂无评论...
验证码 换一张
取 消