Last active
December 17, 2015 03:09
-
-
Save dotKokott/5541189 to your computer and use it in GitHub Desktop.
Determine if player is dragging or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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