浏览代码

Editor: Fix ViewHelper with translated camera.

Mugen87 4 年之前
父节点
当前提交
6c498d49a5
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      editor/js/Viewport.ViewHelper.js

+ 3 - 2
editor/js/Viewport.ViewHelper.js

@@ -198,11 +198,12 @@ function ViewHelper( editorCamera, container ) {
 	this.update = function ( delta ) {
 	this.update = function ( delta ) {
 
 
 		var step = delta * turnRate;
 		var step = delta * turnRate;
+		var focusPoint = this.controls.center;
 
 
 		// animate position by doing a slerp and then scaling the position on the unit sphere
 		// animate position by doing a slerp and then scaling the position on the unit sphere
 
 
 		q1.rotateTowards( q2, step );
 		q1.rotateTowards( q2, step );
-		editorCamera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius );
+		editorCamera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( focusPoint );
 
 
 		// animate orientation
 		// animate orientation
 
 
@@ -258,7 +259,7 @@ function ViewHelper( editorCamera, container ) {
 		//
 		//
 
 
 		radius = editorCamera.position.distanceTo( focusPoint );
 		radius = editorCamera.position.distanceTo( focusPoint );
-		targetPosition.multiplyScalar( radius );
+		targetPosition.multiplyScalar( radius ).add( focusPoint );
 
 
 		dummy.position.copy( focusPoint );
 		dummy.position.copy( focusPoint );