-
Notifications
You must be signed in to change notification settings - Fork 10
Using the SenseGlove_HandModel
A tutorial on how to integrate your own virtual hand model with the SenseGlove SDK, using the SenseGlove_HandModel script.
The kinematic model of the Sense Glove SDK uses a specific coordinate system, which can be seen below. To integrate one's own hand model, it should match this coordinate system in Unity.
The fingers of the hand model should be placed in the 'default' orientation of the Sense Glove kinematic model, where each joint angle (abduction, flexion, pronation) is set to 0 degrees. The thumb must be placed in the same orientation as the fingers, which may look unnatural.
If the starting position of the thumb is unacceptable, a correction of the thumb rotation may be applied by overriding the UpdateHand()
function of the SenseGlove_Handmodel.
One of the more complex steps, collecting the finger joints can be done one of two ways; via the inspector or via code.
The simplest way to assign figner joints, which is done by adding the SenseGlove_VirtualHand script to the hand model.
Via the inspector, one should assign the Transforms for each finger via the thumbJoints
, indexFingerJoints
, middleFingerJoints
, ringFingerJoints
, and pinkyJoints
variables. These public List<Transfrom>
variables will have an initial size of 0, which should be set to 3 before assignment.
Slightly more complex, but also allows for more freedom. This step requires one to create a new script; one that extends the SenseGlove_HandModel class.
Assigning the finger joints is done by implementing the CollectFingerJoints()
method. The purpose of this method is to collect a "list of lists of Transforms" (List<List<Transfrom>>
), that contains the finger joints, from thumb to to pinky, from proximal to distal, and to assign it to the SenseGlove_Handmodel's fingerJoints variable. Take a look at this example from the SenseGlove_Hologram script:
/// <summary>
/// Collect a proper (finger x joint) array, and assign it to this.fingerJoints(). Use the handRoot variable to help you iterate.
/// For this HandModel, the actual rotation joints are hidden a few children deep from the handRoot.
/// </summary>
protected override void CollectFingerJoints()
{
this.fingerJoints.Clear();
foreach (Transform fingerRoot in handRoot)
{
List<Transform> fingerList = new List<Transform>();
{
fingerList.Add(fingerRoot.GetChild(0));
fingerList.Add(fingerRoot.GetChild(0).GetChild(0).GetChild(0));
fingerList.Add(fingerRoot.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(0));
}
this.fingerJoints.Add(fingerList);
}
}
Like any public variable, the foreArmTransform
and the wristTransform
variables can be assigned via the inspector. For the purpose of calibration, it is important that the x-axis of the foreArmTransform object aligns with the virtual forearm.
Optionally, once can assign feedback colliders to their hand model, preferably somewhere near the fingertips. Like the forearm and wrist, these colliders can be assigned via the inspector through the touchColliders
variable. The touchColliders should be assigned from thumb to pinky. SenseGlove_Feedback scripts will be assigned to the touchColliders automatically.