terrain now checks the ray's limit when colliding
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9583 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
d3b280c7e3
commit
b59ec271ca
@ -254,9 +254,15 @@ public class TerrainQuad extends Node implements Terrain {
|
|||||||
picker = new BresenhamTerrainPicker(this);
|
picker = new BresenhamTerrainPicker(this);
|
||||||
|
|
||||||
Vector3f intersection = picker.getTerrainIntersection(ray, results);
|
Vector3f intersection = picker.getTerrainIntersection(ray, results);
|
||||||
if (intersection != null)
|
if (intersection != null) {
|
||||||
return 1;
|
if (ray.getLimit() < Float.POSITIVE_INFINITY) {
|
||||||
|
if (results.getClosestCollision().getDistance() <= ray.getLimit())
|
||||||
|
return 1; // in range
|
||||||
else
|
else
|
||||||
|
return 0; // out of range
|
||||||
|
} else
|
||||||
|
return 1;
|
||||||
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user