Hi everyone, I already read a lot on this topic and I hope that you could help me to solve this problem.
I create a custom version of the voxel example, basically I change the shape of the voxel instead of a cube I put a polygon with hexagon shape. Now I want to put all in one all the shapes that I create (for my application all the shape will have at least one edge in common).
I try without success the following things:
let geom = new THREE.BufferGeometry();
for(let i = 0; i < scene.children.length; i++){
if(scene.children[i].name === "custom-voxel"){
geom.merge(scene.children[i].geometry);
}
}
and this:
var geometries = [];
for(let i = 0; i < scene.children.length; i++){
if(scene.children[i].name === "custom-voxel"){
geometry.push(scene.children[i].geometry.clone());
}
}
geom = mergeBufferGeometries(geometries);
geom.computeBoundingBox();
var meshh = new THREE.Mesh(
geom,
new THREE.MeshBasicMaterial({ color: 0x0000ff })
);
In the second case I have the trouble that all the shape will be merge into a single one, but the position is not keep (they are all in the same place).
Do you have any suggestion?
Thank you.