Răsfoiți Sursa

Editor: Restore camera when exiting VR.

Mr.doob 4 ani în urmă
părinte
comite
068f7c151a
1 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 8 2
      editor/js/Viewport.VR.js

+ 8 - 2
editor/js/Viewport.VR.js

@@ -11,6 +11,8 @@ class VR {
 		const signals = editor.signals;
 
 		let group = null;
+
+		let camera = null;
 		let renderer = null;
 
 		this.currentSession = null;
@@ -41,6 +43,8 @@ class VR {
 
 			}
 
+			camera = editor.camera.clone();
+
 			group.visible = true;
 
 			this.currentSession = session;
@@ -48,9 +52,11 @@ class VR {
 
 			await renderer.xr.setSession( this.currentSession );
 
-		}
+		};
+
+		const onSessionEnded = async () => {
 
-		 const onSessionEnded = async () => {
+			editor.camera.copy( camera );
 
 			group.visible = false;