0
votes

I have imported a model from SketchUp with the Collada loader (three.js). But now I have a problem. I want to always have the center of the object at the coordinates x0 y0 z0. How can I achieve this?

1

1 Answers

0
votes

You should be able to translate/offset your object in SketchUp before exporting so it's centre lies on 0,0,0 then re-export. The other option is to do that in code, using GeometryUtils' center() function:

THREE.GeometryUtils.center(geometry);

Where geometry is the .geometry property of the Object3D you want to centre. Given that you're loading a Collada file, you might have a hierarchy to deal with, so need to be aware which geometry you center.

Another option is to nest the collada in an empty Object3D and offset/translate the collada inside it based on the Collada's bounding box.