|
@@ -32,6 +32,7 @@
|
|
|
package com.jme3.terrain.geomipmap;
|
|
|
|
|
|
import com.jme3.bounding.BoundingBox;
|
|
|
+import com.jme3.bounding.BoundingSphere;
|
|
|
import com.jme3.bounding.BoundingVolume;
|
|
|
import com.jme3.collision.Collidable;
|
|
|
import com.jme3.collision.CollisionResults;
|
|
@@ -44,6 +45,7 @@ import com.jme3.math.FastMath;
|
|
|
import com.jme3.math.Ray;
|
|
|
import com.jme3.math.Vector2f;
|
|
|
import com.jme3.math.Vector3f;
|
|
|
+import com.jme3.math.Quaternion;
|
|
|
import com.jme3.scene.Geometry;
|
|
|
import com.jme3.scene.Node;
|
|
|
import com.jme3.scene.Spatial;
|
|
@@ -850,7 +852,26 @@ public class TerrainQuad extends Node implements Terrain {
|
|
|
affectedAreaBBox = null;
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ Vector2f worldLocVec2 = changedPoint.clone();
|
|
|
+ worldLocVec2.multLocal(new Vector2f(getWorldScale().x, getWorldScale().z));
|
|
|
+ worldLocVec2.addLocal(getWorldTranslation().x, getWorldTranslation().z);
|
|
|
+ changedPoint = worldLocVec2;
|
|
|
+
|
|
|
+ Quaternion wr = getWorldRotation();
|
|
|
+ if (wr.getX() != 0 || wr.getY() != 0 || wr.getZ() != 0) {
|
|
|
+ BoundingVolume bv = getWorldBound();
|
|
|
+ if (bv instanceof BoundingSphere) {
|
|
|
+ BoundingSphere bs = (BoundingSphere) bv;
|
|
|
+ float r = bs.getRadius();
|
|
|
+ Vector3f center = bs.getCenter();
|
|
|
+ affectedAreaBBox = new BoundingBox(center, r, r, r);
|
|
|
+ } else {
|
|
|
+ affectedAreaBBox = (BoundingBox) bv.clone();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (affectedAreaBBox == null) {
|
|
|
affectedAreaBBox = new BoundingBox(new Vector3f(changedPoint.x, 0, changedPoint.y), 1f, Float.MAX_VALUE, 1f); // unit length
|
|
|
} else {
|