Can a 3D object that is totally enveloped by another trigger mouse events?
#5
Here is a code snippet that you can use:

Code:
private void CheckHitObjects(Point mousePosition)
{
    var pointParams = new PointHitTestParameters(mousePosition);

    VisualTreeHelper.HitTest(MainViewport3D, null, HitTestResultHandler, pointParams); // no filer delegate is used

    // if you stored the hit visuals or models (in the HitTestResultHandler), you can check them here
}

private HitTestResultBehavior HitTestResultHandler(HitTestResult result)
{
    hitResult = result as RayMeshGeometry3DHitTestResult;

    if (hitResult == null)
        return HitTestResultBehavior.Stop;
        
    // You can check (or store for later check) the hit Visual3D or GeometryModel3D
    var visualHit = lastRayHitResult.VisualHit;
    var hitModel3D = lastRayHitResult.ModelHit as GeometryModel3D;
    
    // ...
    
    if (continueHitTesting)
        return HitTestResultBehavior.Continue;
        
    return HitTestResultBehavior.Stop;
}
Andrej Benedik
  


Messages In This Thread
RE: Can a 3D object that is totally enveloped by another trigger mouse events? - by abenedik - 03-26-2019, 12:50 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)