Detecting gestures

Highlighted
Zelda
Visitor

Detecting gestures

Hi,
I'm running the sdk via my HTC Vive Pro and Unity (C#) . Everything seems to be working fine so far.
Now I just want to write a simple code that detects which of the five gestures was detected by the camera and then write it in the console. I just can't get it to work even though I feel like this should be an easy one.

Any help is much appreciated.

@zzy 

Vive Staff

Re: Detecting gestures

Hi @Zelda 

 

I think a simple scripts will do:

 

void Update() {
  // do nothing if results is not changed
  if (!GestureProvider.UpdatedInThisFrame) return;

  if (GestureProvider.LeftHand != null)
    Debug.Log("Left gesture is " + GestureProvider.LeftHand.gesture);
  if (GestureProvider.RightHand != null)
    Debug.Log("Right gesture is " + GestureProvider.RightHand.gesture);
}

You can also refer to our usage document or sample document for more usages.

Labels