浏览代码

TransformControls: Improve gizmo rendering with orthographic cameras. (#24242)

Michael Herzog 3 年之前
父节点
当前提交
0877231ac6
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      examples/jsm/controls/TransformControls.js

+ 9 - 1
examples/jsm/controls/TransformControls.js

@@ -205,7 +205,15 @@ class TransformControls extends Object3D {
 		this.camera.updateMatrixWorld();
 		this.camera.matrixWorld.decompose( this.cameraPosition, this.cameraQuaternion, this._cameraScale );
 
-		this.eye.copy( this.cameraPosition ).sub( this.worldPosition ).normalize();
+		if ( this.camera.isOrthographicCamera ) {
+
+			this.camera.getWorldDirection( this.eye );
+
+		} else {
+
+			this.eye.copy( this.cameraPosition ).sub( this.worldPosition ).normalize();
+
+		}
 
 		super.updateMatrixWorld( this );