提交 0ce00ce8 编写于 作者: G gero3

Make BoxHelper workable with Object3D

上级 7dcec4c5
......@@ -84,6 +84,10 @@
line.material.transparent = true;
line.position.x = -4;
group.add( line );
scene.add( new THREE.BoxHelper( group ) );
scene.add( new THREE.BoxHelper( scene ) );
} );
......
......@@ -22,17 +22,31 @@ THREE.BoxHelper.prototype.constructor = THREE.BoxHelper;
THREE.BoxHelper.prototype.update = function ( object ) {
var geometry = object.geometry;
if ( geometry.boundingBox === null ) {
geometry.computeBoundingBox();
var min, max;
if ( object.type == 'Mesh') {
var geometry = object.geometry;
if ( geometry.boundingBox === null ) {
geometry.computeBoundingBox();
}
min = geometry.boundingBox.min;
max = geometry.boundingBox.max;
this.matrix = object.matrixWorld;
this.matrixAutoUpdate = false;
} else {
var box = new THREE.Box3().setFromObject(object);
min = box.min;
max = box.max;
}
var min = geometry.boundingBox.min;
var max = geometry.boundingBox.max;
/*
5____4
1/___0/|
......@@ -95,7 +109,4 @@ THREE.BoxHelper.prototype.update = function ( object ) {
this.geometry.computeBoundingSphere();
this.matrix = object.matrixWorld;
this.matrixAutoUpdate = false;
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册