From b59ec271ca455115a2c4a892b87d4322339ae449 Mon Sep 17 00:00:00 2001 From: "bre..ns" Date: Wed, 25 Jul 2012 00:03:01 +0000 Subject: [PATCH] terrain now checks the ray's limit when colliding git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9583 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/terrain/geomipmap/TerrainQuad.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java index c44d4a335..ad7baecad 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java @@ -254,9 +254,15 @@ public class TerrainQuad extends Node implements Terrain { picker = new BresenhamTerrainPicker(this); Vector3f intersection = picker.getTerrainIntersection(ray, results); - if (intersection != null) - return 1; - else + if (intersection != null) { + if (ray.getLimit() < Float.POSITIVE_INFINITY) { + if (results.getClosestCollision().getDistance() <= ray.getLimit()) + return 1; // in range + else + return 0; // out of range + } else + return 1; + } else return 0; }