diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java index fecebdd19..6024111c5 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java @@ -1048,7 +1048,8 @@ public class TerrainPatch extends Geometry { Mesh regen = geomap.createMesh(stepScale, new Vector2f(1,1), offset, offsetAmount, totalSize, false); setMesh(regen); - TangentBinormalGenerator.generate(this); // note that this will be removed + //TangentBinormalGenerator.generate(this); // note that this will be removed + ensurePositiveVolumeBBox(); } @Override @@ -1072,6 +1073,16 @@ public class TerrainPatch extends Geometry { return clone; } + protected void ensurePositiveVolumeBBox() { + if (getModelBound() instanceof BoundingBox) { + if (((BoundingBox)getModelBound()).getYExtent() < 0.001f) { + // a correction so the box always has a volume + ((BoundingBox)getModelBound()).setYExtent(0.001f); + updateWorldBound(); + } + } + } + } diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java index 66fbe4538..70e92569b 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java @@ -1496,12 +1496,7 @@ public class TerrainQuad extends Node implements Terrain { for (int i = 0; i < getQuantity(); i++) { if (children.get(i) instanceof TerrainPatch) { TerrainPatch tp = (TerrainPatch) children.get(i); - if (tp.getModelBound() instanceof BoundingBox) { - if (((BoundingBox)tp.getModelBound()).getYExtent() == 0) { - // a correction so the box always has a volume - ((BoundingBox)tp.getModelBound()).setYExtent(0.00001f); - } - } + tp.ensurePositiveVolumeBBox(); if (tp.getWorldBound().intersects(toTest)) { CollisionResults cr = new CollisionResults(); toTest.collideWith(tp.getWorldBound(), cr);