three.js不显示所有网格网格、three、js

2023-09-08 10:50:19 作者:姐、专属的范

奇怪的问题,3D Max中2013 obj要three.js 59转,在我的3D Max场景,我有5个对象,多维数据集......然后,当我导入three.js场景我现在只有3个方块。也有支点股份的所有对象的中间:

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); 

你知道吗?

如果我是:

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

它很奇怪。

推荐答案

第一个问题是:

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

另一个问题是支点,从我已经阅读了周围的OBJ格式有一个已知的问题,它的支点网,物体的中心视父变化。 例如:

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.