calcMeshCenter (group) {
const box3 = new Three.Box3()
box3.expandByObject(group)
const center = new Three.Vector3(0, 0, 0)
box3.getCenter(center)
group.position.x = group.position.x - center.x
group.position.y = group.position.y - center.y
group.position.z = group.position.z - center.z
}
在loader里调用这个方法传入模型对象即可实现根据不同设备自动居中
如下
this.calcMeshCenter(scene)