Three.js r68 - Can't get centroids of geometries using OBJMTLLoader

后端 未结 1 831
余生分开走
余生分开走 2021-01-20 19:43

I\'ve been using an old revision of Three.js for quite some time, so I decided to upgrade to the latest (r68). I knew I would bump into some issues, but I wasn\'t expecting

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-20 20:20

    If you want to compute the centroid of the whole geometry this is the code you need:

    geometry.computeBoundingBox();
    
    var centroid = new THREE.Vector3();
    centroid.addVectors( geometry.boundingBox.min, geometry.boundingBox.max );
    centroid.multiplyScalar( - 0.5 );
    
    centroid.applyMatrix4( mesh.matrixWorld );
    

    0 讨论(0)
提交回复
热议问题