Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server_openvr): 🐛 Make SteamVR chaperone consistent with ALVR #2493

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions alvr/server_openvr/cpp/alvr_server/ChaperoneUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ void ShutdownOpenvrClient() {

bool IsOpenvrClientReady() { return isOpenvrInit; }

void ResetChaperoneToStage() {
#ifndef __APPLE__
vr::VRChaperone()->ResetZeroPose(vr::TrackingUniverseRawAndUncalibrated);
#endif
}

void _SetChaperoneArea(float areaWidth, float areaHeight) {
Debug("SetChaperoneArea");

Expand Down Expand Up @@ -96,6 +102,7 @@ void _SetChaperoneArea(float areaWidth, float areaHeight) {
);
}

ResetChaperoneToStage();
#endif
}

Expand Down
21 changes: 11 additions & 10 deletions alvr/server_openvr/cpp/alvr_server/alvr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,25 @@ class DriverProvider : public vr::IServerTrackedDeviceProvider {
}

HapticsSend(id, haptics.fDurationSeconds, haptics.fFrequency, haptics.fAmplitude);
}
} else if (event.eventType == vr::VREvent_ChaperoneUniverseHasChanged
|| event.eventType == vr::VREvent_ChaperoneRoomSetupFinished
|| event.eventType == vr::VREvent_ChaperoneFlushCache
|| event.eventType == vr::VREvent_ChaperoneSettingsHaveChanged
|| event.eventType == vr::VREvent_SeatedZeroPoseReset
|| event.eventType == vr::VREvent_StandingZeroPoseReset
|| event.eventType == vr::VREvent_SceneApplicationChanged
|| event.eventType == VendorEvent_ALVRDriverResync) {
ResetChaperoneToStage();

#ifdef __linux__
else if (event.eventType == vr::VREvent_ChaperoneUniverseHasChanged
|| event.eventType == vr::VREvent_ChaperoneRoomSetupFinished
|| event.eventType == vr::VREvent_ChaperoneFlushCache
|| event.eventType == vr::VREvent_ChaperoneSettingsHaveChanged
|| event.eventType == vr::VREvent_SeatedZeroPoseReset
|| event.eventType == vr::VREvent_StandingZeroPoseReset
|| event.eventType == vr::VREvent_SceneApplicationChanged
|| event.eventType == VendorEvent_ALVRDriverResync) {
if (hmd && hmd->m_poseHistory) {
auto rawZeroPose = GetRawZeroPose();
if (rawZeroPose != nullptr) {
hmd->m_poseHistory->SetTransform(*rawZeroPose);
}
}
}
#endif
Comment on lines 225 to 232
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code might not be needed anymore for linux

}
}
if (vr::VRServerDriverHost()->IsExiting() && !shutdown_called) {
Debug("DriverProvider: Received shutdown event");
Expand Down
1 change: 1 addition & 0 deletions alvr/server_openvr/cpp/alvr_server/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ extern "C" void SetButton(unsigned long long buttonID, FfiButtonValue value);

extern "C" void InitOpenvrClient();
extern "C" void ShutdownOpenvrClient();
extern "C" void ResetChaperoneToStage();
extern "C" void SetChaperoneArea(float areaWidth, float areaHeight);

extern "C" void CaptureFrame();
Expand Down
Loading