Skip to content

Commit 48e613f

Browse files
authored
Merge pull request #20524 from Mugen87/dev51
Editor: Fix ViewHelper with translated camera.
2 parents 7410f62 + 6c498d4 commit 48e613f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

editor/js/Viewport.ViewHelper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,12 @@ function ViewHelper( editorCamera, container ) {
198198
this.update = function ( delta ) {
199199

200200
var step = delta * turnRate;
201+
var focusPoint = this.controls.center;
201202

202203
// animate position by doing a slerp and then scaling the position on the unit sphere
203204

204205
q1.rotateTowards( q2, step );
205-
editorCamera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius );
206+
editorCamera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( focusPoint );
206207

207208
// animate orientation
208209

@@ -258,7 +259,7 @@ function ViewHelper( editorCamera, container ) {
258259
//
259260

260261
radius = editorCamera.position.distanceTo( focusPoint );
261-
targetPosition.multiplyScalar( radius );
262+
targetPosition.multiplyScalar( radius ).add( focusPoint );
262263

263264
dummy.position.copy( focusPoint );
264265

0 commit comments

Comments
 (0)