moved nmgen terrain translation up to findGeoms

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9093 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 13 years ago
parent 209d5d6082
commit d83581ebb4
  1. 10
      sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/NavMeshGenerator.java
  2. 4
      sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/wizard/NewNavMeshWizardAction.java

@ -149,19 +149,19 @@ public class NavMeshGenerator implements Savable {
float[] vertices = new float[length * 3];
int[] indices = new int[(side - 1) * (side - 1) * 6];
Vector3f scale = ((Node) terr).getWorldScale().clone();
Vector3f trans = ((Node) terr).getWorldTranslation().clone();
//Vector3f trans = ((Node) terr).getWorldTranslation().clone();
Vector3f trans = new Vector3f(0,0,0);
trans.x -= terr.getTerrainSize() / 2f;
trans.z -= terr.getTerrainSize() / 2f;
float offsetX = trans.x;// * scale.x;
float offsetZ = trans.z;// * scale.z;
float offsetX = trans.x;
float offsetZ = trans.z;
// do vertices
int i = 0;
for (int z = 0; z < side; z++) {
for (int x = 0; x < side; x++) {
vertices[i++] = x + offsetX;
vertices[i++] = heights[z * side + x];// * scale.y;
vertices[i++] = heights[z * side + x];
vertices[i++] = z + offsetZ;
}
}

@ -102,8 +102,10 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
Mesh merged = generator.terrain2mesh(terr);
Geometry g = new Geometry("mergedTerrain");
g.setMesh(merged);
if (node != originalRoot)
if (node != originalRoot) {
g.setLocalScale(((Node)terr).getLocalScale());
g.setLocalTranslation(((Node)terr).getLocalTranslation());
}
geoms.add(g);
return geoms;
}

Loading…
Cancel
Save