CLOSE - 如何在 THREE.js 中合并网格 (r128)
我想要做的是,我创建一个自定义形状体素,并且我想将不同的自定义体素合并为一个。 我尝试使用:
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);
}
}
但它不起作用,所以我尝试使用:
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 })
);
但这样它也不起作用,或者更好的是它在同一位置创建所有对象,你知道如何保持之间的距离吗?物体?
谢谢。
what I want to do is the following, I create a custom shape voxel and I want to merge the different custom voxels into a single one.
I try with:
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);
}
}
But it doesn't work so I try with:
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 })
);
But in this way it also doesn't work or better it create the all object in the same position, do you have an idea on how I can keep the distance between objects?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论