Centering an object with BufferGeometry.center()
does only center the geometry. It does not work if the object or its ancestors are transformed. Hence, it’s better to use the following pattern:
const box = new THREE.Box3().setFromObject( gltf.scene );
const center = box.getCenter( new THREE.Vector3() );
gltf.scene.position.x += ( gltf.scene.position.x - center.x );
gltf.scene.position.y += ( gltf.scene.position.y - center.y );
gltf.scene.position.z += ( gltf.scene.position.z - center.z );
As you can see, you compute the bounding box of the entire scene and then offset its origin according to the AABB’s center point.