Skip to content

Instantly share code, notes, and snippets.

@dotKokott
Last active December 17, 2015 03:09
Show Gist options
  • Save dotKokott/5541189 to your computer and use it in GitHub Desktop.
Save dotKokott/5541189 to your computer and use it in GitHub Desktop.
Determine if player is dragging or not
private InteractionHandPointer getHandPointer() {
UserInfo userInfo;
var hand = JointType.HandLeft;
if (UserInfos.TryGetValue(Player.Skeleton.TrackingId, out userInfo)) {
return (from InteractionHandPointer hp in userInfo.HandPointers where hp.HandType == hand select hp).FirstOrDefault();
}
return null;
}
public override void Update(GameTime gameTime) {
var handPointer = getHandPointer();
if (handPointer != null) {
if (handPointer.HandEventType == InteractionHandEventType.Grip) {
IsGrabbing = true;
} else if (handPointer.HandEventType == InteractionHandEventType.GripRelease) {
IsGrabbing = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment