Selaa lähdekoodia

Merge pull request #68321 from BastiaanOlij/xrorigin_start_pos

Update XRServer with starting position of (new) current XROrigin3D
Rémi Verschelde 2 vuotta sitten
vanhempi
commit
c4f3b94abf
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      scene/3d/xr_nodes.cpp

+ 6 - 0
scene/3d/xr_nodes.cpp

@@ -644,6 +644,12 @@ void XROrigin3D::set_current(bool p_enabled) {
 				origin_nodes[i]->set_current(false);
 			}
 		}
+
+		// update XRServer with our current position
+		XRServer *xr_server = XRServer::get_singleton();
+		ERR_FAIL_NULL(xr_server);
+
+		xr_server->set_world_origin(get_global_transform());
 	} else {
 		bool found = false;
 		// We no longer have a current origin so find the first one we can make current