Smart Centering and Scaling after Model Import in three.js

前端 未结 2 768
独厮守ぢ
独厮守ぢ 2021-02-03 13:18

Is there a way to determine the size and position of a model and then auto-center and scale the model so that it is positioned at the origin and within the view of the camera? I

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 14:04

    try geometry.center()

    center: function () {
    
        var offset = new Vector3();
    
        return function center() {
    
            this.computeBoundingBox();
    
            this.boundingBox.getCenter( offset ).negate();
    
            this.translate( offset.x, offset.y, offset.z );
    
            return this;
    
        };
    
    }(),
    

提交回复
热议问题