From 40f02b9404fcb8e2b95324e182592334dada1afa Mon Sep 17 00:00:00 2001 From: Sapphire Date: Tue, 3 Jun 2025 16:19:54 -0500 Subject: [PATCH] Add hip tracking toggle for fb body tracking * Only forward hip joint from FB_body_tracking when lower body is enabled * Fix body tracking tooltips being too wide --- client/configuration.cpp | 3 +++ client/configuration.h | 1 + client/scenes/lobby_gui.cpp | 17 +++++++++++++---- client/scenes/stream.cpp | 8 ++++++-- client/scenes/stream_tracking.cpp | 2 +- client/xr/fb_body_tracker.cpp | 12 ++++++++---- client/xr/fb_body_tracker.h | 3 ++- 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/client/configuration.cpp b/client/configuration.cpp index 557e9094..ca8685e6 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -226,6 +226,8 @@ configuration::configuration(xr::system & system) if (auto val = root["fb_lower_body"]; val.is_bool()) fb_lower_body = val.get_bool(); + if (auto val = root["fb_hip"]; val.is_bool()) + fb_hip = val.get_bool(); if (auto val = root["virtual_keyboard_layout"]; val.is_string()) virtual_keyboard_layout = val.get_string().value(); @@ -350,6 +352,7 @@ void configuration::save() json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled; json << ",\"mic_unprocessed_audio\":" << std::boolalpha << mic_unprocessed_audio; json << ",\"fb_lower_body\":" << std::boolalpha << fb_lower_body; + json << ",\"fb_hip\":" << std::boolalpha << fb_hip; for (auto & [key, value]: features) json << "," << key << ":" << std::boolalpha << value; json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout); diff --git a/client/configuration.h b/client/configuration.h index 565dc6dd..cdfdd8f5 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -55,6 +55,7 @@ public: bool mic_unprocessed_audio = false; bool fb_lower_body = false; + bool fb_hip = true; // Snapdragon Game Super Resolution struct sgsr_settings diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 09333779..238a4b3f 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -758,11 +758,9 @@ void scenes::lobby::gui_settings() else { if (application::get_fb_body_tracking_supported()) - tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings, otherwise estimated joint positions will be used")); + tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise estimated joint positions will be used")); else if (application::get_pico_body_tracking_supported()) - { tooltip(_("Uses the Pico Motion Trackers to track body joint positions")); - } } } @@ -778,7 +776,18 @@ void scenes::lobby::gui_settings() } vibrate_on_hover(); if (ImGui::IsItemHovered()) - tooltip(_("Estimate lower body joint positions using Generative Legs, requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings")); + tooltip(_("Estimate lower body joint positions using Generative Legs\nRequires 'Hand and body tracking' to be enabled in the Quest movement tracking settings")); + + ImGui::BeginDisabled(not config.fb_lower_body); + if (ImGui::Checkbox(_S("Enable hip tracking"), &config.fb_hip)) + { + config.save(); + } + vibrate_on_hover(); + if (ImGui::IsItemHovered()) + tooltip(_("Only takes affect with lower body tracking enabled\nMay be desired when using another source of hip tracking")); + ImGui::EndDisabled(); + ImGui::Unindent(); ImGui::EndDisabled(); } diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index bd1388ec..1f64c129 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -231,8 +231,12 @@ std::shared_ptr scenes::stream::create(std::unique_ptrfull_body = full_body; + this->hip = hip; XrBodyTrackerCreateInfoFB create_info{ .type = XR_TYPE_BODY_TRACKER_CREATE_INFO_FB, @@ -100,11 +101,14 @@ std::optional poses{}; + int num_poses = 0; for (int i = 0; i < joint_whitelist.size(); i++) { auto joint = joint_whitelist[i]; - if (!full_body && joint >= XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META) - break; + if (!full_body && (joint == XR_FULL_BODY_JOINT_HIPS_META || joint >= XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META)) + continue; + if (!hip && joint == XR_FULL_BODY_JOINT_HIPS_META) + continue; auto joint_pose = joints[joint]; wivrn::from_headset::body_tracking::pose pose{ @@ -121,7 +125,7 @@ std::optional> locate_spaces(XrTime time, XrSpace reference);