public override void Update(Kinect.SkeletonInfo info) { base.Update(info); //Vector3 newLeft = info.LocationToGestureSpace(info.leftWrist); //Vector3 newRight = info.LocationToGestureSpace(info.rightWrist); //Vector2 shoulderBump = KinectLocationToFarseerLocation((info.centerShoulder - info.torso) * .2f, info); leftShoulder = info.LocationToGestureSpace(info.leftShoulder); rightShoulder = info.LocationToGestureSpace(info.rightShoulder); //leftShoulderFarseer = GestureLocationToFarseerLocation(leftShoulder, info); //if (!wasAsleep && wasPossessed) //{ if (rightCooldown > 0) { rightCooldown--; } else { //Vector3 rightVel = (newRight - rightWrist) / info.TimeDiff; if (shouldFire(rightWrist, rightVel, rightShoulder)) { fire(rightWrist, rightVel, true); rightCooldown = cooldown; } } if (leftCooldown > 0) { leftCooldown--; } else { //Vector3 leftVel = (newLeft - leftHand) / info.TimeDiff; if (shouldFire(leftWrist, leftVel, leftShoulder)) { fire(leftWrist, leftVel, false); leftCooldown = cooldown; } } //} //rightHand = newRight; //leftHand = newLeft; }
public override void Update(Kinect.SkeletonInfo info) { base.Update(info); if (leftSilk != null && handRetracted(leftWrist, leftShoulder)) { UndoSilk(false); } if (rightSilk != null && handRetracted(rightWrist, rightShoulder)) { UndoSilk(true); } }
public override void Update(Kinect.SkeletonInfo info) { base.Update(info); if (leftHandGrabGrace > 0) { leftHandGrabGrace--; } if (rightHandGrabGrace > 0) { rightHandGrabGrace--; } if (!rightGrip && info.rightHand.Z < info.torso.Z + grabPlane && rightVel.Z < grabVel) { rightHandGrabGrace = grabGrace; //TryRightGrip(); } if (rightHandGrabGrace > 0) { TryRightGrip(); } else if (rightGrip && info.rightHand.Z > info.torso.Z + releasePlane) { ReleaseRightGrip(); } if (!leftGrip && info.leftHand.Z < info.torso.Z + grabPlane && leftVel.Z < grabVel) { leftHandGrabGrace = grabGrace; //TryLeftGrip(); } if (leftHandGrabGrace > 0) { TryLeftGrip(); } else if (leftGrip && info.leftHand.Z > info.torso.Z + releasePlane) { ReleaseLeftGrip(); } }
public override void Update(Kinect.SkeletonInfo info) { base.Update(info); flappedLeft = flappedRight = false; if (ShouldFlap(leftWrist, leftVel)) { flappedLeft = true; ExertFlapLeft(leftVel); } if (ShouldFlap(rightWrist, rightVel)) { flappedRight = true; ExertFlapRight(rightVel); } }
public override void Update(Kinect.SkeletonInfo info) { base.Update(info); if (!thrustOn && !ragdoll.asleep && ticksAfterThrust >= 0) { if (ticksAfterThrust < 20) { Vector2 bodyVel = ragdoll.Body.LinearVelocity; stoppingThrustVector = -.6f * bodyVel; ApplyStoppingForce(); ticksAfterThrust++; } else { stoppingThrustVector = Vector2.Zero; ticksAfterThrust = -1; } } }
public override void Update(Kinect.SkeletonInfo info) { //Vector3 newRight = info.LocationToGestureSpace(info.rightWrist); //Vector3 newLeft = info.LocationToGestureSpace(info.leftWrist); if (wasUncontrolled) { rightVel = Vector3.Zero; leftVel = Vector3.Zero; } else { rightVel = info.rightWristVel; leftVel = info.leftWristVel; } rightWrist = info.LocationToGestureSpace(info.rightWrist); leftWrist = info.LocationToGestureSpace(info.leftWrist); if (!ragdoll.asleep && ragdoll.Possessed) { wasUncontrolled = false; } }