命中测试 WPF 3D 模型零件
我有一个大的ModelVisual3D
(例如汽车),它分为许多较小的GeometryModel3D
对象(例如轮胎、座椅、车轮等)。
我想在单击鼠标时测试 ModelVisual3D
并确定哪个 GeometryModel3D
被点击。我可以点击测试我的汽车(ModelVisual3D
),但无法确定汽车的哪一部分(GeometryModel3D
对象)被单击。
有谁知道在处理 MouseLeftButtonDown
事件(或任何其他鼠标事件)时如何确定模型的确切部分?
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 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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看 http://www.kindohm.com/technical/ComplexVisuals.htm - 我相信那里解释的机制会有帮助。
Have a look at http://www.kindohm.com/technical/ComplexVisuals.htm - I believe the mechanisms explained there will help.
此博客文章展示了如何使用该框架进行光线测试:
http://blogs.msdn.com/b/wpf3d/archive/2009/05/18/3d-hit-testing.aspx
回调中的结果包含有关相交网格的详细信息,您可以从中获取相交网格的特定部分。
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.