1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils'
const geo = new THREE.BoxGeometry(1, 1, 1) const geo1 = new THREE.BoxGeometry(2, 2, 2) geo1.translate(1.5, 0, 0);
const mergedGeometries = BufferGeometryUtils.mergeBufferGeometries([geo, geo1], true)
mergedGeometries.center()
const singleMergeMesh = new THREE.Mesh(mergedGeometries, [ new THREE.MeshLambertMaterial({ color: 'red' }), new THREE.MeshLambertMaterial({ color: 'pink' }), ] )
addObjectToScene([singleMergeMesh])
|