Hello,
I have 512 cube objects, which I have successfully merged into a single mesh (using the Merge class), so that it now looks like a large 8x8x8 cube:
merge = new Merge(true, true);
var meshes:Vector.<Mesh> = new Vector.<Mesh>();
for (var i:int = 0; i < 8; i++) {
for (var j:int = 0; j < 8; j++) {
for (var k:int = 0; k < 8; k++) {
var cube:Cube = new Cube(material, 25, 25, 25);
if (i == 0 && j == 0 && k == 0) {
cube.position = new Vector3D(-87.5, 12.5, 100);
}
else
cube.position = new Vector3D(12.5*i, 12.5*j, 12.5*k);
meshes.push(cube);
}
}
}
var mergedMesh:Mesh = merge.applyToMeshes(meshes.shift(), meshes);
view.scene.addChild(mergedMesh);
However, the fact that the “position” of the merged mesh is defined to be the position of the first small cube I created (-87.5, 12.5, 100), rather than the “real center” of the large merged mesh (0, 100, 100), is causing me problems in some other stuff I want to do.
Does anyone know how I would go about redefining which point in the mesh is the “position”?
I tried MeshHelper.recenter(mergedMesh) from the MeshHelper class, but it doesn’t seem to do what I want.
Thanks