Custom VR glove controller

Hey all, I am making a custom VR glove and I am trying to figure out the best way to map values of the flex sensors on each finger in unity.

There are two sensors per finger (one covering the middle and end joint and the other covering the knuckle). I am looking to have a clean and simple way to control the amount of bend (or flex) of each finger in the unity model.

For example: indexFinger.middleJoint.anlge = 90; //sets the middle joint to 90 degrees
I know this code isnt corect, but I am looking for something similar.

Is there a general “hand manager” or a way of controlling a rig that makes this process easy?
Or even a package that can streamline the whole process?

Greatly Appreciated

No, there isn’t. You’ll need to just set the rotations of each joint yourself. The code isn’t that much different from what you posted:

indexFinger.middleJoint.localEulerAngles = (90, 0, 0); // sets the middle joint to 90 degrees

But exactly which axis you rotate around will depend on how your hand model was made. There is no hard standard.

Best,

  • Joe
1 Like

Thank you, this helps a lot. One quick question, how would you structure it? These are a few ways I think I could do it.

//New variable for each finger part
public GameObject indexTip;
public GameObject indexMid;

indexTip.localEulerAngles = (90, 0, 0);

//GameObject array for each finger
public GameObject[] index;
index = new GameObject[3];
index[2] = indexTipObject.GameObject;

index[2].localEulerAngles = (90, 0, 0);

//Get GameObjects as children
public GameObject indexFinger;

indexFinger.transform.getChild(0).localEulerAngles = (90, 0, 0);

Thanks

Personally I’d go with the first one — just declare a public property for each joint, and assign them in the inspector.