fix(shim): swap L/R joints (mirror swaps MediaPipe labels - verified) + amplify arm reach 1.6x/1.3x (MediaPipe compresses hand-relative range vs real Kinect, UTKinect-measured) so the menu cursor covers the full screen. Shim-side so no tracker rebuild needed.

This commit is contained in:
kinect-bot committed 2026-11-27 00:19:53 -05:00
1 parent cb5e8f7865
commit 552beedd15
1 file changed
+26 -1
+26 -1
View File
@@ -732,12 +732,37 @@ void VirtualKinectSensor::BuildSkeletonFrame(const SourceFrame& src) {
// 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;
// The tracker mirrors the camera (win_main), and mirroring SWAPS MediaPipe's
// L/R labels (verified: a mirrored frame's RIGHT_WRIST lands where the
// normal frame's LEFT_WRIST was), so the player's right side arrives in the
// NUI LEFT joint slots. Swap L/R back here - shim-side, so the fix does not
// depend on the tracker recompiling core/mapping. Then amplify each arm
// outward from its shoulder: MediaPipe reports a compressed hand-relative
// reach (measured ~1.6x smaller in x, ~1.3x in y vs real Kinect v1 against
// UTKinect recordings), which made the menu hand-cursor cover only part of
// the screen for a full arm sweep. The hip/center-of-mass (data.Position) is
// untouched, so the validity box + vFloorClipPlane are unaffected.
static const int kSwap[contract::kJointCount] = {
0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 16, 17, 18, 19, 12, 13, 14, 15};
for (std::size_t j = 0; j < contract::kJointCount; ++j) {
const contract::JointData& joint = src.meta.skeleton.joints[j];
const contract::JointData& joint = src.meta.skeleton.joints[kSwap[j]];
data.SkeletonPositions[j] = {joint.position.x, joint.position.y,
joint.position.z, joint.position.w};
data.eSkeletonPositionTrackingState[j] = NUI_SKELETON_POSITION_TRACKED;
}
const float kArmGainX = 1.6f, kArmGainY = 1.3f;
auto amp_arm = [&](int j, int shoulder) {
auto& p = data.SkeletonPositions[j];
const auto& s = data.SkeletonPositions[shoulder];
p.x = s.x + (p.x - s.x) * kArmGainX;
p.y = s.y + (p.y - s.y) * kArmGainY;
};
amp_arm(9, 8);
amp_arm(10, 8);
amp_arm(11, 8); // right arm from SHOULDER_RIGHT
amp_arm(5, 4);
amp_arm(6, 4);
amp_arm(7, 4); // left arm from SHOULDER_LEFT
}
static unsigned build_calls = 0;