Skip to content

Commit 3bead41

Browse files
author
Léna Voinchet
committed
Fix orthocam to perspcam bug
1 parent dd4fb5e commit 3bead41

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

js/UI/Popup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,14 @@ class Popup{
164164
break;
165165
case "hand-tracking":
166166
sceneManager.heightDetectedObservable.set(0.25)
167+
sceneManager.sceneElevation = 0.7;
167168
break;
168169
case "human-tracking":
169170
default:
170171
sceneManager.heightDetectedObservable.set(1.2)
171172
break;
172173
}
174+
sceneManager.objects.removeDummies();
173175
//reset warning messages on successive tabs
174176
resetWarnings();
175177
});

js/ViewportManager.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,16 @@ class ViewportManager{
232232
//this.activeCamera.position.set(newPos.x, newPos.y, newPos.z);
233233
this.placeCamera(newPos);
234234

235-
orbitControls.dispose();
236-
orbitControls = buildOrbitControls(this);
235+
// Update camera reference in the existing OrbitControls
236+
orbitControls.object = this.activeCamera;
237+
orbitControls.update();
237238

239+
// Update gizmo as well
238240
controlsGizmo.dispose();
239-
controlsGizmo = buildGuizmo(orbitControls, this)
241+
controlsGizmo = buildGuizmo(orbitControls);
242+
243+
orbitControls.target.set(0, 0, 0);
244+
240245
}
241246

242247

@@ -252,7 +257,7 @@ class ViewportManager{
252257
perspCam.aspect = aspect;
253258
perspCam.updateProjectionMatrix();
254259

255-
orthoCam.left = - frustumSize/ 2.0;
260+
orthoCam.left = - frustumSize / 2.0;
256261
orthoCam.right = frustumSize / 2.0;
257262
orthoCam.top = frustumSize / (2.0 * aspect);
258263
orthoCam.bottom = - frustumSize / (2.0 * aspect);

0 commit comments

Comments
 (0)