I’ve figured out how to clone the geometry but I can not see subsequent geometries; can somone help me?
Box wall = new Box(1,1,1);
geomWall = new Geometry("Box",wall);
Material wallMat = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
wallMat.setColor("Color",ColorRGBA.Cyan);
geomWall.setMaterial(mat);
Box longWall = new Box(20,1,1);
geomLongWall = new Geometry("Box",wall);
Material matLongWall = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matLongWall.setColor("Color",ColorRGBA.Red);
geomLongWall.setMaterial(matLongWall);
Box tallWall = new Box(1,20,1);
geomTallWall = new Geometry("Box",wall);
Material matTallWall = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matTallWall.setColor("Color",ColorRGBA.Red);
geomTallWall.setMaterial(matTallWall);
int[][] map =
{
{2},
{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{3},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{2},
};
map[0][0] = 2;
map[13][13] = 2;
for(int i = 0; i < map.length; i++){
for (int j = 0; j < map[i].length; j++){
switch (map[i][j]) {
case 1:
geom = geomWall.clone(true);
geom.setLocalTranslation(i,j,1f);
geom.setLocalScale(1f,1f,1f);
break;
case 2:
geomCloneLong = geomLongWall.clone(true);
geomCloneLong.setLocalTranslation(i,j,1f);
geomCloneLong.setLocalScale(20f,1f,1f);
break;
case 3:
geomCloneTall = geomTallWall.clone(true);
geomCloneLong.setLocalTranslation(i,j,1f);
geomCloneLong.setLocalScale(1f,20f,1f);
break;
default:
break;
}
}
}