我一直在研究THREEJS框架来呈现*.dae模型。有几个dae模型。我对模特的位置有问题。当我渲染它们时,每个模型都有不同的位置。我设置了他们的位置dae.position.set(0,0,0);,但不幸的是,它不能完美地工作。
例如,对于一个模型,我必须将位置设置为dae.position.set(-2, -31, 6.5);,然后将模型设置为位置(0、0、0)。我用axes.position.set(0,0,0);轴检查它。
你知道吗,为什么模型不在x,y,z的零位置上。
谢谢你的帮助。我对three.js完全陌生。我希望我能清楚地解释自己:)
发布于 2015-07-20 16:26:58
模型的顶点从原点偏移,所以您要通过设置dae.position来进行补偿。
您可以通过重新输入模型来自动调整dae的位置,如下所示:
var box = new THREE.Box3().setFromObject( dae ); // compute the bounding box of the model
box.getCenter( dae.position ); // set dae.position to be the center of the bounding box
dae.position.multiplyScalar( - 1 ); // negate the dae.position coordinatesthree.js r.87
https://stackoverflow.com/questions/31514187
复制相似问题