Works if you just use an objectcontainer3D and add wall,floor cubes to that
and then after the for loop merge that objectcontainer and add to the scene.

eg

var _merger:Merge= new Merge(false, true, true);
var obj:ObjectContainer3D = new ObjectContainer3D();

for (var py:uint = 0; py < _map.length; py++) {
for (var pz:uint = 0; pz < _map[py].length; pz++ ) {
for (var px:uint = 0; px < _map[py][pz].length; px++ ) {
switch(_map[py][pz][px]) {
case 1://FLOOR
var floorCube:Cube = new Cube(floorMaterial, CUBESIZE, CUBESIZE, CUBESIZE);
floorCube.moveTo(CUBESIZE * px, CUBESIZE * py, CUBESIZE * pz);
obj.addChild(floorCube);

break;
case 2://WALL
var wallCube:Cube = new Cube(wallMaterial, CUBESIZE, CUBESIZE, CUBESIZE);
wallCube.moveTo(CUBESIZE * px, CUBESIZE * py, CUBESIZE * pz);
obj.addChild(wallCube);
break;
}
}
}
}
_view.scene.addChild(_merger.applyToContainer(obj));

Reply via email to