Skip to content

Commit 068f7c1

Browse files
committed
Editor: Restore camera when exiting VR.
1 parent 9522135 commit 068f7c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

editor/js/Viewport.VR.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class VR {
1111
const signals = editor.signals;
1212

1313
let group = null;
14+
15+
let camera = null;
1416
let renderer = null;
1517

1618
this.currentSession = null;
@@ -41,16 +43,20 @@ class VR {
4143

4244
}
4345

46+
camera = editor.camera.clone();
47+
4448
group.visible = true;
4549

4650
this.currentSession = session;
4751
this.currentSession.addEventListener( 'end', onSessionEnded );
4852

4953
await renderer.xr.setSession( this.currentSession );
5054

51-
}
55+
};
56+
57+
const onSessionEnded = async () => {
5258

53-
const onSessionEnded = async () => {
59+
editor.camera.copy( camera );
5460

5561
group.visible = false;
5662

0 commit comments

Comments
 (0)