fixed collisiongroup check on grid change

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7720 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
ant..om 14 years ago
parent 9790cff2c3
commit e4983751c7
  1. 12
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java

@ -29,7 +29,6 @@ import com.jme3.terrain.heightmap.HeightMapGrid;
public class TerrainGrid extends TerrainQuad { public class TerrainGrid extends TerrainQuad {
private static final Logger log = Logger.getLogger(TerrainGrid.class.getCanonicalName()); private static final Logger log = Logger.getLogger(TerrainGrid.class.getCanonicalName());
private Vector3f currentCell; private Vector3f currentCell;
private int quarterSize; private int quarterSize;
private int quadSize; private int quadSize;
@ -120,7 +119,7 @@ public class TerrainGrid extends TerrainQuad {
} }
public void initialize(Vector3f location) { public void initialize(Vector3f location) {
if(this.material == null){ if (this.material == null) {
throw new RuntimeException("Material must be set prior to call of initialize"); throw new RuntimeException("Material must be set prior to call of initialize");
} }
Vector3f camCell = this.getCell(location); Vector3f camCell = this.getCell(location);
@ -202,7 +201,7 @@ public class TerrainGrid extends TerrainQuad {
kym = 1; kym = 1;
} }
for (int i=kym; i<kyM; i++) { for (int i = kym; i < kyM; i++) {
for (int j = kxm; j < kxM; j++) { for (int j = kxm; j < kxM; j++) {
cache.get(cam.add(quadIndex[i * 4 + j])); cache.get(cam.add(quadIndex[i * 4 + j]));
} }
@ -249,10 +248,11 @@ public class TerrainGrid extends TerrainQuad {
this.updateModelBound(); this.updateModelBound();
if (control != null) { if (control != null) {
int currentCollisionGroup = control.getCollideWithGroups(); int collisionGroupsCollideWith = control.getCollideWithGroups();
int collisionGroups = control.getCollisionGroup();
control = new RigidBodyControl(new HeightfieldCollisionShape(getHeightMap(), getLocalScale()), 0); control = new RigidBodyControl(new HeightfieldCollisionShape(getHeightMap(), getLocalScale()), 0);
control.setCcdMotionThreshold(0.5f); control.setCollideWithGroups(collisionGroupsCollideWith);
control.setCollisionGroup(currentCollisionGroup); control.setCollisionGroup(collisionGroups);
this.addControl(control); this.addControl(control);
space.add(this); space.add(this);
} }

Loading…
Cancel
Save