three.js not displaying all meshes

旧街凉风 提交于 2019-12-25 04:53:15

问题


weird issues with 3d max 2013 obj to three.js 59 rev, in my 3d max scene i have 5 objects , cubes ...Then when i import into three.js scene i now only have 3 cubes. also there pivot point shares to the middle of all objects:

       var loader = new THREE.OBJMTLLoader();
       loader.load( 'models/cubes.obj') ;
       loader.addEventListener( 'load', function ( event ) {

       object = event.content;
       for(k in object.children){

        group.add(object.children[k]); // console said there 5 objects

        }

      });

       scene.add(group); 

Any idea?

If i was to :

     group.add(object); // i will see my five cubes or 
     scene.add(object) //but then i cant access the children at all

Its very strange.


回答1:


The first issue is:

    var loader = new THREE.OBJMTLLoader();  //should be using OBJLoader

The other issue was the pivot point, from what i have read up around the net that the obj format has a known issue with its pivot, centre of object varies depending on the parent. for example:

If you have three meshes cubes equal as each other, spaced out however. The pivot point of each object is not its center of its self but the centre of all the objects together.

After putting each object in its own 3d Container, this still does not solve the issue.



来源:https://stackoverflow.com/questions/20547365/three-js-not-displaying-all-meshes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!