Search Unity

Oculus Quest Hand Tracking - Costum Hands / Default Hands

Discussion in 'VR' started by MrWolf, Jan 7, 2020.

  1. MrWolf

    MrWolf

    Joined:
    Jun 9, 2013
    Posts:
    11
    Hi,

    I'm trying to implement the new hand tracking for the Oculus Quest, I see in Oculus SDK two solutions example scenes.
    My goal is to attach to the hands some colliders to detect which finger is bent towards the palm (academic research).

    The first is to use Oculus default hands prefabs. which seems to create the hands mesh during runtime, the hands work great and are responsive, but because the mesh is created on runtime, I'm unable to add the colliders in the right position before hand (unless I'm missing something).

    On the other hand, the SDK comes with an example scene to use custom hands models. In such solution I would be able to add the colliders directly to the hands model.
    But I'm unable to control the finger tracking (only position of the palm is tracked it seems). the model remains static (regarding fingers movement).
    More over, I don't understand how to implement custom model (other than the model provided in the SDK) to be controlled by the hands tracking system. (Is there a specific hierarchy needed, or other guidelines).
    Not much information is available at the moment on the relevant documentation page.

    To sum things up:
    - How to implement finger tracking on custom hand models?
    - How to add colliders to the default hand tracking prefab?

    Solution to either problem would be much helpful,
    Thanks in advance,

    Omri.
     
    fhernoux, Avalin and CAMBCN like this.
  2. brandonjm

    brandonjm

    Joined:
    Mar 9, 2016
    Posts:
    3
    I can't answer your first question as I found this while searching for an answer to the same problem however I can answer your second.

    How to add colliders to the default hand tracking prefab?

    As you noted you can't see the hand structure in the Inspector however it is possible to get the Transforms of all the bones in the hand at run time from the OVRSkeleton attached to the Hand prefab. Transforms must be on a GameObject therefore you can add a collider to specific bones, or make a pre-configured collider object a child of the bone, etc. I wasn't able to find an efficient way of getting a specific bone without just searching for it so there may be a simpler solution.

    Code (CSharp):
    1. public OVRSkeleton skeleton;
    2.  
    3. void Start() {
    4.     // Add collider to tip of index finger
    5.     foreach(OVRBone bone in skeleton.Bones) {
    6.         if (bone.Id == OVRSkeleton.BoneId.Hand_IndexTip) {
    7.             bone.Transform.gameObject.AddComponent<SphereCollider>();
    8.         }
    9.     }
    10. }
    Make sure you are using OVRSkeleton and not HandSkeleton. The naming is a little confusing but HandSkeleton is for a hand that is controlled through a Touch controller while OVRSkeleton is for Quest hand tracking.
     
    MrWolf likes this.