Explorar el Código

Call offerSession at session end time (#27368)

Rik Cabanier hace 1 año
padre
commit
f394e711c1

+ 7 - 0
examples/jsm/webxr/ARButton.js

@@ -104,6 +104,13 @@ class ARButton {
 
 					currentSession.end();
 
+					if ( navigator.xr.offerSession !== undefined ) {
+
+						navigator.xr.offerSession( 'immersive-ar', sessionInit )
+							.then( onSessionStarted );
+
+					}
+
 				}
 
 			};

+ 7 - 0
examples/jsm/webxr/VRButton.js

@@ -70,6 +70,13 @@ class VRButton {
 
 					currentSession.end();
 
+					if ( navigator.xr.offerSession !== undefined ) {
+
+						navigator.xr.offerSession( 'immersive-vr', sessionInit )
+							.then( onSessionStarted );
+
+					}
+
 				}
 
 			};

+ 7 - 0
examples/jsm/webxr/XRButton.js

@@ -74,6 +74,13 @@ class XRButton {
 
 					currentSession.end();
 
+					if ( navigator.xr.offerSession !== undefined ) {
+
+						navigator.xr.offerSession( mode, sessionOptions )
+							.then( onSessionStarted );
+
+					}
+
 				}
 
 			};