2D characters and unity

Hi, is it possible to control 2D characters within Unity using Nuitrack. For example a punch gesture will propel the user to move right.

Thanks

Hi lewi,

Yes, you can use Nuitrack for this purpose. For example, you can take a look at HandTracker Module: http://download.3divi.com/Nuitrack/doc/group__HandTracker__group.html and Gesture Recognizer Module: http://download.3divi.com/Nuitrack/doc/group__GestureRecognizer__group.html

How would I go about integrating that with the 2d character controller? sorry I am quite new.

For example I have:

        float h = CrossPlatformInputManager.GetAxis("Horizontal");

which moves the character with the keyboard. I’m hoping one of the demos has some sample code that I could place in here. I know that’s simplifying it a lot but any pointers or tips? It doesn’t have to be a punch gesture either, just any movement from the depth camera really.

Thanks.

Please take a look at the code below:

//Speed of your character will depend on the position of a right hand. Also, you have to tick “HandTrackerModule On” in the “NuitrackManager” section in Unity.

public float h;

void OnEnable () 
{
     NuitrackManager.HandTracker.OnUpdateEvent += OnHandUpdate;
}

private void OnHandUpdate(nuitrack.HandTrackerData handTrackerData)
{
     if (handTrackerData.UsersHands.Length < 1)
          return;

     nuitrack.UserHands userHands = handTrackerData.UsersHands[CurrentUserTracker.CurrentUser];

     if (userHands.RightHand != null)
          h = userHands.RightHand.Value.X*2-1;
}

Thank you :slight_smile: