Răsfoiți Sursa

Revert "Focus will frame target in view. Object will only translate to focus on target, will not rotate. Fixed a bug where empty's couldn't be focused on."

This reverts commit 65a7e2823e03643d7dee4cc52892d4b136120ad0.
Adam 7 ani în urmă
părinte
comite
eab0344769
1 a modificat fișierele cu 1 adăugiri și 31 ștergeri
  1. 1 31
      examples/js/controls/EditorControls.js

+ 1 - 31
examples/js/controls/EditorControls.js

@@ -37,36 +37,8 @@ THREE.EditorControls = function ( object, domElement ) {
 
 	this.focus = function ( target ) {
 
-		if ( target === undefined || !target.isObject3D ) {
-			return;
-		}
-
 		var box = new THREE.Box3().setFromObject( target );
-
-		var targetDistance;
-
-		if ( box.isEmpty() ) {
-
-			// Focusing on an empty such as a light.
-
-			target.getWorldPosition( center );
-			targetDistance = 0.5;
-
-		} else {
-
-			center.copy( box.getCenter() );
-			targetDistance = box.getBoundingSphere().radius * 6;
-
-		}
-
-		var forwards = object.getWorldDirection().normalize();
-
-		var targetDelta = forwards.multiplyScalar( -targetDistance );
-
-		var targetWorldPosition = targetDelta.add( center );
-
-		object.position.copy( targetWorldPosition );
-
+		object.lookAt( center.copy( box.getCenter() ) );
 		scope.dispatchEvent( changeEvent );
 
 	};
@@ -227,8 +199,6 @@ THREE.EditorControls = function ( object, domElement ) {
 
 	// touch
 
-	var touch = new THREE.Vector3();
-
 	var touches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
 	var prevTouches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];