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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -231,8 +231,12 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
if (application::get_fb_body_tracking_supported())
|
||||
{
|
||||
auto num_trackers = config.fb_lower_body
|
||||
? xr::fb_body_tracker::joint_whitelist.size()
|
||||
: std::ranges::count_if(xr::fb_body_tracker::joint_whitelist, [](auto & joint) { return joint < XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META; });
|
||||
? std::ranges::count_if(xr::fb_body_tracker::joint_whitelist, [&config](auto joint) {
|
||||
return config.fb_hip || joint != XR_FULL_BODY_JOINT_HIPS_META;
|
||||
})
|
||||
: std::ranges::count_if(xr::fb_body_tracker::joint_whitelist, [](auto joint) {
|
||||
return joint != XR_FULL_BODY_JOINT_HIPS_META && joint < XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META;
|
||||
});
|
||||
info.num_generic_trackers = num_trackers;
|
||||
}
|
||||
else if (application::get_pico_body_tracking_supported())
|
||||
|
||||
@@ -274,7 +274,7 @@ void scenes::stream::tracking()
|
||||
body_tracking = body_fb;
|
||||
// We start the tracker on connection because there are togglable settings.
|
||||
// TODO handle reconnection?
|
||||
application::get_fb_body_tracker().start(config.fb_lower_body);
|
||||
application::get_fb_body_tracker().start(config.fb_lower_body, config.fb_hip);
|
||||
}
|
||||
else if (application::get_pico_body_tracking_supported())
|
||||
body_tracking = body_pico;
|
||||
|
||||
@@ -37,10 +37,11 @@ xr::fb_body_tracker::~fb_body_tracker()
|
||||
stop();
|
||||
}
|
||||
|
||||
void xr::fb_body_tracker::start(bool full_body)
|
||||
void xr::fb_body_tracker::start(bool full_body, bool hip)
|
||||
{
|
||||
assert(xrCreateBodyTrackerFB);
|
||||
this->full_body = full_body;
|
||||
this->hip = hip;
|
||||
|
||||
XrBodyTrackerCreateInfoFB create_info{
|
||||
.type = XR_TYPE_BODY_TRACKER_CREATE_INFO_FB,
|
||||
@@ -100,11 +101,14 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
|
||||
}
|
||||
|
||||
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> 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<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
|
||||
if (joint_pose.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
|
||||
pose.flags |= wivrn::from_headset::body_tracking::position_tracked;
|
||||
|
||||
poses[i] = std::move(pose);
|
||||
poses[num_poses++] = std::move(pose);
|
||||
}
|
||||
return poses;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class fb_body_tracker
|
||||
PFN_xrDestroyBodyTrackerFB xrDestroyBodyTrackerFB{};
|
||||
|
||||
bool full_body{};
|
||||
bool hip{};
|
||||
|
||||
public:
|
||||
static constexpr std::array joint_whitelist{
|
||||
@@ -62,7 +63,7 @@ public:
|
||||
fb_body_tracker(instance & inst, session & s);
|
||||
~fb_body_tracker();
|
||||
|
||||
void start(bool lower_body);
|
||||
void start(bool lower_body, bool hip);
|
||||
void stop();
|
||||
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
|
||||
|
||||
Reference in New Issue
Block a user