2021-03-31

 // fit camera to object
            var bBox = new THREE.Box3().setFromObject(this.obj);
            this.obj.updateWorldMatrix(true,true)
            var height = bBox.size().y;
            var dist = height / (2 * Math.tan(this.Camare.fov * Math.PI / 360));
            var pos = this.scene.position;
            // let v3 = this.obj.geometry.center()
            // console.log("v3",v3)
            // this.target = v3
            this.Camare.position.set( pos.x, pos.y, dist * 1.5)

            //  this.obj.position.set(
            //       - ( this.obj.geometry.boundingBox.max.x + this.obj.geometry.boundingBox.min.x ) / 2,
            //       - ( this.obj.geometry.boundingBox.max.y + this.obj.geometry.boundingBox.min.y ) / 2,
            //       - ( this.obj.geometry.boundingBox.max.z + this.obj.geometry.boundingBox.min.z ) / 2,
            //   )
posted @ 2023-02-02 11:00  过好每一天2022  阅读(17)  评论(0)    收藏  举报