使用 Helixtoolkit.SortingVisual3D 通过透明表面单击事件 [英] Click Event through transparent surface using Helixtoolkit.SortingVisual3D

查看:44
本文介绍了使用 Helixtoolkit.SortingVisual3D 通过透明表面单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的可点击蓝色立方体在我通过透明表面 MeshGeometryVisual3D 元素点击它时改变颜色.当立方体容器是 ViewPort 类的子项时,一切正常,但无法通过表面看到(无排序),但是当它是 Helixtoolkit.SortingVisual3D 的子项时,单击事件停止工作,但通过表面可见!这是我使用的 SortingVisual3D 元素的代码:

添加到 SortingVisual3D 元素的立方体的代码是这样的:

 AddCubePoint cpsorting = new AddCubePoint(middle, defaultMaterial);排序Visual1.Children.Add(cpsorting);

我曾尝试在相同位置使用两个相同的立方体(ViewPort 的一个子项,SortingVisual3D 的第二个),但是在表面后面单击时颜色会发生变化,仅在 ViewPort 的子项上(见图)!

我是 helix-3d-toolkit 的新手,经过 2 天的研究,我找不到任何可行的解决方案或想法如何解决这个问题!请帮帮我!

解决方案

您需要将立方体放在半透明网格之前,因此首先渲染立方体.将透明网格命中测试设置为 false

I want my clickable blue cube to change a color while I click on it through transparent surface MeshGeometryVisual3D element. When the cube container is a children of the ViewPort class everything works fine but is not visible through the surface (no sorting), but when it is children of Helixtoolkit.SortingVisual3D the click event stops to work but is visible through the surface! This is the code of SortingVisual3D elements what I use:

<helix:SortingVisual3D x:Name="sortingVisual1" Method="BoundingSphereSurface" SortingFrequency="5" >  
   <helix:MeshGeometryVisual3D x:Name="_visual"  MeshGeometry="{Binding objectGeometry}"   Visible="{Binding IsChecked, ElementName=MeshVisible}" >
   </helix:MeshGeometryVisual3D>
</helix:SortingVisual3D>

The code of the cube adding to SortingVisual3D element is this:

 AddCubePoint cpsorting = new AddCubePoint(middle, defaultMaterial);
            sortingVisual1.Children.Add(cpsorting);

I have tried to use two identical cubes (one child of ViewPort, the second of SortingVisual3D) at the same position, but the color changes on clicking behind the surface, only on children of ViewPort (see the picture)!

I am new to helix-3d-toolkit and after 2 days research I couldn't find any workable solution or idea how to solve this problem ! Please, help me !

解决方案

You need to put the cube before your semi transparent mesh, so the cube is rendered first. Set your transparent mesh hit test visible to false

这篇关于使用 Helixtoolkit.SortingVisual3D 通过透明表面单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆