title: How can I perform a Hit Test on one specifc 3d object in WPF?
body: <p>I have a SphereMesh (inherits from MeshGeneratorBase as part of the Petzold.Media3D.dll) in my WPF 3D Scene. I also have thousands of ScreenSpaceLines3D objects on that sphere. I want to ignore everything in my scene except the SphereMesh and find out the X-Y-Z coordinate of where my mouse ray intersects with the sphere only. Even if there is another object X between the sphere and the mouse, I still want to know where the mouse would hit the sphere, as if object X didn't exist.  </p>
  
  <p>I've tried the below code using HitTest, but as I add thousands/millions of other objects in my scene/world, it becomes extremely slow. And the object obstruction issue is another problem I can't resolve. </p>
  
  <p>What do you recommend?</p>
  
  <p>Current code:</p>
  
  <pre><code>Point mousePos = new Point(x, y);
  PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
  VisualTreeHelper.HitTest(
      viewPort,null,
      delegate(HitTestResult hr)
      {
          RayMeshGeometry3DHitTestResult rayHit = hr as RayMeshGeometry3DHitTestResult;
      if(rayHit != null)
      {
          // Mouse hits something
          Console.WriteLine("Point: " + rayHit.PointHit);
      }
      return HitTestResultBehavior.Continue;
  }, hitParams);
  </code></pre>
  
  <p>Any help? </p>
  
  <p>Thanks.</p>