Hello community !
I’m facing this problem and I tried to update external resources matrix or matrixWorld.
But it seems the performance is not what it meant to be.
Figure1
Firgure 1 is scene set up,i’m doing csg with gltf model tank and box.
What i did looks like firgure2
Figure2
It’s all messed up , I tried to update matrixes,but it’s not working.
new GLTFLoader().load('./resources/loader/tzz1/scene.gltf', gltf => {
const g = new BoxGeometry(1, 1, 1)
const brush1 = new Brush(g, new THREE.MeshLambertMaterial({
transparent: true,
opacity: 0.1
}));
brush1.position.y = 1
brush1.updateMatrixWorld()
this.scene.add(brush1)
// figure2 code
// gltf.scene.rotateX(0.5*Math.PI)
this.scene.add(gltf.scene)
gltf.scene.traverse(e => {
if (e.isMesh) {
e.geometry.scale(0.0005, 0.0005, 0.0005)
e.updateMatrix()
const brush2 = new Brush(e.geometry, new THREE.MeshLambertMaterial())
const result = csgEvaluator.evaluate(brush2, brush1, SUBTRACTION);
if (result) {
e.geometry = result.geometry
}
}
})
})
Thanks to gkjohnson lib,csg is now like really fast.And threejs of course!
Yet various external models have their own hierarchy , it’s a problem to me cause i have to deal with a dozen of external models , plus if each model has it’s own specific process, the codes will be too big.
Is there a way to update the transforms to what it looks like?