kinect step support
This commit is contained in:
parent
ab6e468207
commit
41b6eb26aa
@ -230,6 +230,7 @@ void pollKinect() {
|
|||||||
|
|
||||||
// main loop to read and process skeleton data
|
// main loop to read and process skeleton data
|
||||||
NUI_SKELETON_FRAME skeletonFrame = { 0 };
|
NUI_SKELETON_FRAME skeletonFrame = { 0 };
|
||||||
|
float errorMargin = 0.02;
|
||||||
while (true) {
|
while (true) {
|
||||||
// get the latest skeleton frame
|
// get the latest skeleton frame
|
||||||
hr = NuiSkeletonGetNextFrame(0, &skeletonFrame);
|
hr = NuiSkeletonGetNextFrame(0, &skeletonFrame);
|
||||||
@ -252,6 +253,22 @@ void pollKinect() {
|
|||||||
feet[1].event.y = 0.5;
|
feet[1].event.y = 0.5;
|
||||||
feet[2].event.x = rightLegPos.x;
|
feet[2].event.x = rightLegPos.x;
|
||||||
feet[2].event.y = 0.5;
|
feet[2].event.y = 0.5;
|
||||||
|
|
||||||
|
// check for stepping
|
||||||
|
if (leftLegPos.y > (rightLegPos.y + errorMargin)) {
|
||||||
|
feet[2].touching = true;
|
||||||
|
feet[1].touching = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (rightLegPos.y > (leftLegPos.y + errorMargin)) {
|
||||||
|
feet[1].touching = true;
|
||||||
|
feet[2].touching = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
feet[1].touching = true;
|
||||||
|
feet[2].touching = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user