Hi I’d like to reset of gltf.scene center to it’s children mesh box center
The original looks like this (group center is too below)
So I coded like this
scene.add(gltf.scene);
const sphere = new THREE.Sphere();
const bs = new THREE.Box3().setFromObject(gltf.scene).getBoundingSphere(sphere);
const centerDelta = new THREE.Vector3().copy(bs.center).multiplyScalar(-1);
scene.traverse((c) => {
if (c instanceof THREE.Mesh && c.material instanceof THREE.MeshStandardMaterial) {
c.position.add(centerDelta);
}
});
But the result is:
I think the problem is gltf group xyz direction is different with it’s center.
Is there any way to change child’s xyz direction to gltf group direction? It would be best solution to my next step
thanks for reading!