浏览代码

Editor: Restore camera when exiting VR.

Mr.doob 4 年之前
父节点
当前提交
068f7c151a
共有 1 个文件被更改,包括 8 次插入2 次删除
  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;