fix(windows-nui): report all skeleton joints TRACKED so game's joint-ratio>0.85 gate builds a valid orientation transform (was degenerate -> every skeleton rejected)
This commit is contained in:
1 parent
8a86cac605
commit
f05525607a
1 file changed
+15
-24
@@ -598,30 +598,21 @@ void VirtualKinectSensor::BuildSkeletonFrame(const SourceFrame& src) {
|
||||
src.meta.skeleton.joints[NUI_SKELETON_POSITION_HIP_CENTER].position;
|
||||
data.Position = {hip.x, hip.y, hip.z, hip.w};
|
||||
|
||||
// TITLE_SETS_TRACKED_SKELETONS protocol: the app first sees skeletons as
|
||||
// POSITION_ONLY (center of mass + ID only), picks IDs, and promotes them to
|
||||
// full tracking via NuiSkeletonSetTrackedSkeletons. If we report TRACKED
|
||||
// before the app selects our ID, the game's selection scan finds no
|
||||
// position-only candidate, locks nobody ([0,0]) and never draws. So only
|
||||
// emit full joints once the app has selected our ID.
|
||||
const bool title_sets =
|
||||
(skeleton_flags_ &
|
||||
NUI_SKELETON_TRACKING_FLAG_TITLE_SETS_TRACKED_SKELETONS) != 0;
|
||||
const bool selected =
|
||||
requested_tracked_ids_[0] == id || requested_tracked_ids_[1] == id;
|
||||
|
||||
if (!title_sets || selected) {
|
||||
data.eTrackingState = NUI_SKELETON_TRACKED;
|
||||
for (std::size_t j = 0; j < contract::kJointCount; ++j) {
|
||||
const contract::JointData& joint = src.meta.skeleton.joints[j];
|
||||
data.SkeletonPositions[j] = {joint.position.x, joint.position.y,
|
||||
joint.position.z, joint.position.w};
|
||||
data.eSkeletonPositionTrackingState[j] =
|
||||
MapJointState(joint.tracking_state);
|
||||
}
|
||||
} else {
|
||||
// Discovery phase: center-of-mass only, joints stay NOT_TRACKED.
|
||||
data.eTrackingState = NUI_SKELETON_POSITION_ONLY;
|
||||
// The game derives its skeleton-validation view-transform from the joints
|
||||
// whose tracking state == TRACKED, and only builds a valid (non-degenerate)
|
||||
// transform when the weighted tracked-joint ratio exceeds 0.85 (gamekdm
|
||||
// FUN_10018570, threshold DAT_102b9c18). MediaPipe leaves lower-body/hand
|
||||
// joints below that visibility, so reporting them INFERRED keeps the ratio
|
||||
// under 0.85 -> the transform is degenerate and EVERY skeleton (even a
|
||||
// perfect one) is rejected, so the game selects nobody ([0,0]) and draws
|
||||
// nothing. Report the whole skeleton TRACKED with every joint TRACKED so
|
||||
// the ratio is 1.0 and the transform is built from our (correct) joints.
|
||||
data.eTrackingState = NUI_SKELETON_TRACKED;
|
||||
for (std::size_t j = 0; j < contract::kJointCount; ++j) {
|
||||
const contract::JointData& joint = src.meta.skeleton.joints[j];
|
||||
data.SkeletonPositions[j] = {joint.position.x, joint.position.y,
|
||||
joint.position.z, joint.position.w};
|
||||
data.eSkeletonPositionTrackingState[j] = NUI_SKELETON_POSITION_TRACKED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user