recentering position of headset
I'm trying to recenter the direction of the players viewpoint (by running a small program before launching the actual game) the program uses openvr.h and openvr_api.dll to recenter.
the new center only moves the directional arrow to the front of the user, but does not rotate the base square or base calibration of the headset...
is there a way to recenter the base calibration? or maybe in other words, to make a new room calibration quickly (skipping the UI process, and pre programming the height etc.)
the reason is due to some games (need to test mor, but for now i think its games) that use Unity, run on the base calibration, not the direction i set. while Unreal Engine games use the correct center which was set through the small program.
my folder structure includes: //files from this project openvr_api.dll openvr.h
// my files vr.h vr.cpp vr.dll (compiled from the above files, and used in other projects to call the specific function to recenter as seen below)
//vr.h
#pragma once
#include "./openvr.h"
extern "C" {
__declspec(dllexport) std::string doRecenter();
}
//vr.cpp
#include "vr.h"
vr::IVRSystem* init() {
// Initialize OpenVR
vr::IVRSystem* vrSystem = vr::VR_Init(nullptr, vr::EVRApplicationType::VRApplication_Scene);
if (!vrSystem) {
return nullptr;
}
return vrSystem;
}
void recenter() {
vr::VRChaperone()->ResetZeroPose(vr::TrackingUniverseStanding);
}
void shutdown() {
vr::VR_Shutdown();
}
std::string doRecenter() {
auto vrSys = init();
if (vrSys == nullptr) {
return "Fail to init VR";
}
recenter();
shutdown();
return "";
}
these are compiled to a dll file
I would also like to know if there is a way to run the recenter code without exiting the current game (if i run the above, it will stop the current vr game before recentering). this might be simply because i am not calling the functions correctly, or there is other better ways to do it.
overall, I would like to launch the VR game in the background, and make it not visible to the user, while i show them another program that guides them to look straight and complete room calibration. this might need a new thread (running 2 vr games at the same time while controlling which one is in view)
thank you to anyone who has the knowledge as is willing to help, it will be appreciated so much, i've been trying different things for so long, until i found these methods, and i think this is the correct way to go, i just feel like my knowledge and level might be lacking