Willow Posted July 2, 2019 Share Posted July 2, 2019 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! Link to comment Share on other sites More sharing options...
zzy Posted July 3, 2019 Share Posted July 3, 2019 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); } Link to comment Share on other sites More sharing options...
Willow Posted July 3, 2019 Author Share Posted July 3, 2019 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.