File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -58,27 +58,27 @@ THREE.EditorControls = function (_object, domElement) {
5858 return ;
5959 }
6060 var distance ;
61+ var localCenterY ;
6162
6263 box . setFromObject ( target ) ;
6364
6465 if ( box . isEmpty ( ) === false && ! isNaN ( box . min . x ) ) {
6566 box . getCenter ( center ) ;
6667 distance = box . getBoundingSphere ( sphere ) . radius ;
68+ localCenterY = ( box . max . y - box . min . y ) / 2 ;
6769 } else {
68- // Focusing on an Group, AmbientLight, etc
69-
70+ // Focusing on an AmbientLight, etc
7071 center . setFromMatrixPosition ( target . matrixWorld ) ;
7172 distance = 0.1 ;
73+ localCenterY = target . position . y ;
7274 }
7375
7476 object . position . copy (
7577 target . localToWorld (
76- new THREE . Vector3 ( 0 , center . y + distance * 0.5 , distance * 2.5 )
78+ new THREE . Vector3 ( 0 , localCenterY + distance * 0.5 , distance * 2.5 )
7779 )
7880 ) ;
79- const pos = target . getWorldPosition ( new THREE . Vector3 ( ) ) ;
80- pos . y = center . y ;
81- object . lookAt ( pos ) ;
81+ object . lookAt ( center ) ;
8282
8383 scope . dispatchEvent ( changeEvent ) ;
8484 } ;
You can’t perform that action at this time.
0 commit comments