Skip to content

Commit

Permalink
Merge pull request #1061 from 3DStreet/fix-jump
Browse files Browse the repository at this point in the history
Fix initial camera jump
  • Loading branch information
kfarr authored Feb 7, 2025
2 parents 9b33023 + d9c88ee commit 0daea55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/editor/lib/EditorControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,9 @@ THREE.EditorControls = function (_object, domElement) {
}
object.updateProjectionMatrix();
} else {
object.position.set(0, 15, 30);
object.lookAt(new THREE.Vector3(0, 1.6, -1));
center.set(0, 1.6, 0); // same as in viewport.js
object.position.set(0, 15, 30); // same as in camera.js
object.lookAt(center);
object.updateMatrixWorld();
}

Expand Down
3 changes: 2 additions & 1 deletion src/editor/lib/cameras.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function initCameras(inspector) {
perspectiveCamera.far = 20000; // Changed from 10000 to 20000
perspectiveCamera.near = 0.01;
perspectiveCamera.position.set(0, 15, 30);
perspectiveCamera.lookAt(new THREE.Vector3(0, 1.6, -1));
const center = new THREE.Vector3(0, 1.6, 0); // same as in viewport.js
perspectiveCamera.lookAt(center);
perspectiveCamera.updateMatrixWorld();
sceneEl.object3D.add(perspectiveCamera);
sceneEl.camera = perspectiveCamera;
Expand Down

0 comments on commit 0daea55

Please sign in to comment.