Jump to content
 
Sign in to follow this  
Willow

how can I add more gestures?

Recommended Posts

Hi, I'm new to this SDK, and I'm planning to use this SDK in Unity.

 

Can I add more gestures? How?

 

Thank you!

Share this post


Link to post
Share on other sites

Hi ,

 

Currently the predefined gestures cannot be customized in the SDK, since adding each new gesture requires a lot effort.

 

However, if you are using skeleton mode on Windows, you can customize your gesture using the skeleton results. You can use the 3D skeleton positions to calcualte straight/folded states of each finger and determine gesture. For example, if all the fingers are folded, then it's a fist gesture.

 

A recommend way is to use the `ModelRenderer` script to get smoothed skeleton and calculate bending angle of each finger. Below is a sample code for calculate bending angle of each finger.

 

Note: Below code uses raw hand data for illustration purpose, you can change to use the bone objects in hand model for better result.

  // fingerIndex is 0-4, for thumb-tail  // result is in [0 (straight), 180 (folded)]  float GetFingerAngle(GestureResult hand, int fingerIndex) {    int startIndex = fingerIndex * 4 + 1;    Vector3 root = hand.points[startIndex];    Vector3 joint1 = hand.points[startIndex + 1];    Vector3 joint2 = hand.points[startIndex + 2];    Vector3 top = hand.points[startIndex + 3];     Vector3 vec1 = joint1 - root;    Vector3 vec2 = joint2 - joint1;    Vector3 vec3 = top - joint2;     float angle = Vector3.Angle(vec1, vec2) + Vector3.Angle(vec2, vec3);    return Mathf.Clamp(angle, 0, 180);  }

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...