PDA

Click to See Complete Forum and Search --> : How to Capture Multiple Hits


quddusaliquddus
Apr 28th, 2009, 02:50 PM
Hi,
I have the following code (which works):

Dim viewPort As Viewport3D = TryCast(sender, Viewport3D)
Dim mousePosition As Point = e.GetPosition(viewPort)
Dim result As HitTestResult = VisualTreeHelper.HitTest(viewPort, mousePosition)

Dim rayResult As RayHitTestResult = TryCast(result, RayHitTestResult)
Dim intIndice As Integer
If rayResult IsNot Nothing Then
Dim rayMeshResult As RayMeshGeometry3DHitTestResult = TryCast(rayResult, RayMeshGeometry3DHitTestResult)
If rayMeshResult IsNot Nothing Then
Dim extraCube As New ModelVisual3D()
extraCube = TryCast(rayMeshResult.VisualHit, ModelVisual3D)
intIndice = V.Children.IndexOf(extraCube)
End If
End If
MessageBox.Show(intIndice)This works fine in getting th index of the VisualModel3D that was clicked.

I read somewhere that when two objects overlap and you click it - then details of both of them are returned.

I wanted to know what I have to add to the above code to accomplish this. I would like the names of the overlapped objects to be retieved.

Thanks

Q