mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.89k stars 35.32k forks source link

I want to load a 3d file into the scene. #1571

Closed ghost closed 12 years ago

ghost commented 12 years ago

I found that the "THREE.ColladaLoader()" can load a 3d model file of dae into the scene.But when I tempt to put it into a mesh,like THREE.Mesh(daeGeometry,material),it warned "Uncaught TypeError: Object [object Object] has no method 'computeBoundingSphere' "...And I noticed that there is an example which load a JSON model and it's available to put into a mesh.Like this---https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_json_objconverter.html So,the point is whether it is unable to load a dae model packed in a mesh directly and I have to convert the 3d model into JSON file or there was something wrong when I tried to load a dae file?I was referring to this example---https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_collada.html..Thanks for help.

chandlerprall commented 12 years ago

The webgl_loader_collada example you linked to first loads the collada file and then adds it directly to the scene. There's no creating a new mesh, it loads the whole collada scene into three.js

ghost commented 12 years ago

So if I create a mesh with the model contained,I should convert the dae or any other 3d models into JSON file,using "convert_obj_three.py" ?

chandlerprall commented 12 years ago

Yes. The collada importer will load in the whole dae scene. To use the object as a normal mesh you'll have to export it into the json format.

ghost commented 12 years ago

Thanks.I've found the exporter written by python and I've succeed to convert the type.