diff --git a/android/app/src/main/cpp/code/vr/vr_base.c b/android/app/src/main/cpp/code/vr/vr_base.c index ba986cfb..6970be90 100644 --- a/android/app/src/main/cpp/code/vr/vr_base.c +++ b/android/app/src/main/cpp/code/vr/vr_base.c @@ -294,6 +294,13 @@ void VR_EnterVR( engine_t* engine, ovrJava java ) { ALOGE("Failed to create XR session: %d.", initResult); exit(1); } + + // Create a space to the first path + XrReferenceSpaceCreateInfo spaceCreateInfo = {}; + spaceCreateInfo.type = XR_TYPE_REFERENCE_SPACE_CREATE_INFO; + spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW; + spaceCreateInfo.poseInReferenceSpace.orientation.w = 1.0f; + OXR(xrCreateReferenceSpace(engine->appState.Session, &spaceCreateInfo, &engine->appState.HeadSpace)); } void VR_LeaveVR( engine_t* engine ) { diff --git a/android/app/src/main/cpp/code/vr/vr_renderer.c b/android/app/src/main/cpp/code/vr/vr_renderer.c index 1e162f17..8ec4a1c1 100644 --- a/android/app/src/main/cpp/code/vr/vr_renderer.c +++ b/android/app/src/main/cpp/code/vr/vr_renderer.c @@ -285,14 +285,9 @@ void VR_InitRenderer( engine_t* engine ) { free(referenceSpaces); - // Create a space to the first path - XrReferenceSpaceCreateInfo spaceCreateInfo = {}; - spaceCreateInfo.type = XR_TYPE_REFERENCE_SPACE_CREATE_INFO; - spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW; - spaceCreateInfo.poseInReferenceSpace.orientation.w = 1.0f; - OXR(xrCreateReferenceSpace(engine->appState.Session, &spaceCreateInfo, &engine->appState.HeadSpace)); - - VR_Recenter(engine); + if (engine->appState.CurrentSpace == XR_NULL_HANDLE) { + VR_Recenter(engine); + } projections = (XrView*)(malloc(ovrMaxNumEyes * sizeof(XrView)));