Browse Source

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

Michael Herzog 3 years ago
parent
commit
0877231ac6
1 changed files with 9 additions and 1 deletions
  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.updateMatrixWorld();
 		this.camera.matrixWorld.decompose( this.cameraPosition, this.cameraQuaternion, this._cameraScale );
 		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 );
 		super.updateMatrixWorld( this );