问题
I have been working on THREEJS framework to render *.dae models. There are several dae models. I have a problem with the location of the models. When I render them, each model has a different location. I set their location dae.position.set(0,0,0);
but unfortunately, it doesn't work perfectly.
For example, for one model I have to set the location as dae.position.set(-2, -31, 6.5);
and then model is on the location(0,0,0). I check it with AXES axes.position.set(0,0,0);
.
Do you have any idea, why is the model not on the zero location for x,y,z.
Thank you for helping. I am totally new to three.js. I hope I explained myself clearly :)
回答1:
The vertices of the model are offset from the origin, so you are compensating by setting the dae.position
.
You can automatically adjust the dae position by recentering the model like so:
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 coordinates
three.js r.87
来源:https://stackoverflow.com/questions/31514187/threejs-collada-model-location