Only ask actual hand tracking in lobby
This commit is contained in:
+11
-13
@@ -980,29 +980,27 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
{
|
||||
auto windows = imgui_ctx->windows();
|
||||
|
||||
auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (left.joints)
|
||||
auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime).joints;
|
||||
if (left)
|
||||
{
|
||||
if (left.is_input_source())
|
||||
stick_finger_to_gui(*left.joints, windows);
|
||||
stick_finger_to_gui(*left, windows);
|
||||
hide_left_controller = true;
|
||||
}
|
||||
|
||||
auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (right.joints)
|
||||
auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime).joints;
|
||||
if (right)
|
||||
{
|
||||
if (right.is_input_source())
|
||||
stick_finger_to_gui(*right.joints, windows);
|
||||
stick_finger_to_gui(*right, windows);
|
||||
hide_right_controller = true;
|
||||
}
|
||||
|
||||
hand_model::apply(world, left.joints ? &*left.joints : nullptr, right.joints ? &*right.joints : nullptr);
|
||||
hand_model::apply(world, left ? &*left : nullptr, right ? &*right : nullptr);
|
||||
|
||||
if (not new_gui_position and head_position and left.joints and left.is_input_source())
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, *left.joints, *head_position);
|
||||
if (not new_gui_position and head_position and left)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, *left, *head_position);
|
||||
|
||||
if (not new_gui_position and head_position and right.joints and right.is_input_source())
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, *right.joints, *head_position);
|
||||
if (not new_gui_position and head_position and right)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, *right, *head_position);
|
||||
}
|
||||
|
||||
if (head_position and new_gui_position)
|
||||
|
||||
@@ -1095,15 +1095,15 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
|
||||
if (left_hand and right_hand)
|
||||
{
|
||||
auto left = left_hand->locate(world_space, predicted_display_time);
|
||||
auto right = right_hand->locate(world_space, predicted_display_time);
|
||||
auto left = left_hand->locate(world_space, predicted_display_time).joints;
|
||||
auto right = right_hand->locate(world_space, predicted_display_time).joints;
|
||||
|
||||
if (left.joints and left.is_input_source() and
|
||||
xr::hand_tracker::check_flags(*left.joints, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
if (left and
|
||||
xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_left_controller = true;
|
||||
|
||||
if (right.joints and right.is_input_source() and
|
||||
xr::hand_tracker::check_flags(*right.joints, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
if (right and
|
||||
xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_right_controller = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -400,10 +400,14 @@ void scenes::stream::tracking()
|
||||
|
||||
if (hand_tracking)
|
||||
{
|
||||
std::array data_sources = {
|
||||
XR_HAND_TRACKING_DATA_SOURCE_UNOBSTRUCTED_EXT,
|
||||
XR_HAND_TRACKING_DATA_SOURCE_CONTROLLER_EXT,
|
||||
};
|
||||
if (std::ranges::contains(pattern, device_id::LEFT_HAND, &to_headset::tracking_control::sample::device))
|
||||
{
|
||||
if (not left_hand)
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT, data_sources);
|
||||
}
|
||||
else
|
||||
left_hand.reset();
|
||||
@@ -411,7 +415,7 @@ void scenes::stream::tracking()
|
||||
if (std::ranges::contains(pattern, device_id::RIGHT_HAND, &to_headset::tracking_control::sample::device))
|
||||
{
|
||||
if (not right_hand)
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT, data_sources);
|
||||
}
|
||||
else
|
||||
right_hand.reset();
|
||||
|
||||
Reference in New Issue
Block a user