Skip to content

Commit 9e815c0

Browse files
committed
Bypass body tracker if not supported by the runtime
1 parent 6f0c925 commit 9e815c0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/core/deviceio/cpp/full_body_tracker_pico.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ FullBodyTrackerPico::Impl::Impl(const OpenXRSessionHandles& handles)
7171
}
7272
if (!body_tracking_props.supportsBodyTracking)
7373
{
74-
throw std::runtime_error("Body tracking not supported by this system");
74+
std::cerr << "[FullBodyTrackerPico] Body tracking not supported by this system, running in limp mode"
75+
<< std::endl;
76+
return;
7577
}
7678
}
7779
else
@@ -86,11 +88,6 @@ FullBodyTrackerPico::Impl::Impl(const OpenXRSessionHandles& handles)
8688
loadExtensionFunction(handles.instance, handles.xrGetInstanceProcAddr, "xrLocateBodyJointsBD",
8789
reinterpret_cast<PFN_xrVoidFunction*>(&pfn_locate_body_joints_));
8890

89-
if (!pfn_create_body_tracker_ || !pfn_destroy_body_tracker_ || !pfn_locate_body_joints_)
90-
{
91-
throw std::runtime_error("Failed to get body tracking function pointers");
92-
}
93-
9491
XrBodyTrackerCreateInfoBD create_info{ XR_TYPE_BODY_TRACKER_CREATE_INFO_BD };
9592
create_info.next = nullptr;
9693
create_info.jointSet = XR_BODY_JOINT_SET_FULL_BODY_JOINTS_BD;
@@ -106,10 +103,9 @@ FullBodyTrackerPico::Impl::Impl(const OpenXRSessionHandles& handles)
106103

107104
FullBodyTrackerPico::Impl::~Impl()
108105
{
109-
assert(pfn_destroy_body_tracker_ != nullptr && "pfn_destroy_body_tracker must not be null");
110-
111106
if (body_tracker_ != XR_NULL_HANDLE)
112107
{
108+
assert(pfn_destroy_body_tracker_ != nullptr && "pfn_destroy_body_tracker must not be null");
113109
pfn_destroy_body_tracker_(body_tracker_);
114110
body_tracker_ = XR_NULL_HANDLE;
115111
}
@@ -119,6 +115,12 @@ bool FullBodyTrackerPico::Impl::update(XrTime time)
119115
{
120116
last_update_time_ = time;
121117

118+
if (body_tracker_ == XR_NULL_HANDLE)
119+
{
120+
tracked_.data.reset();
121+
return true;
122+
}
123+
122124
XrBodyJointsLocateInfoBD locate_info{ XR_TYPE_BODY_JOINTS_LOCATE_INFO_BD };
123125
locate_info.next = nullptr;
124126
locate_info.baseSpace = base_space_;

0 commit comments

Comments
 (0)