Search Unity

InputTracking.GetLocalPosition hand tracking

Discussion in 'AR/VR (XR) Discussion' started by hardcodednumber, Nov 10, 2017.

  1. hardcodednumber

    hardcodednumber

    Joined:
    May 26, 2014
    Posts:
    88
    I want to know why when I use InputTracking.GetLocalPosition, the positional information for my hand feels off. By a few units. It's more apparent when I hit the guardian bounds. I've notice that the values are always below where my actual hand is.

    All I am doing is:
    Code (csharp):
    1.  
    2.         private void Update()
    3.         {
    4.             if (_transform != null && _state.tracked) {
    5.                 _localPosition = InputTracking.GetLocalPosition(_node);
    6.                 _localRotation = InputTracking.GetLocalRotation(_node);
    7.  
    8.                 _transform.localPosition = _localPosition;
    9.                 _transform.localRotation = _localRotation;
    10.             }
    11.         }
    12.  
    Should I use a value to offset the height?
     
  2. hardcodednumber

    hardcodednumber

    Joined:
    May 26, 2014
    Posts:
    88
    I just added an offset of (0,1,0). Seems fine now? I'm sure this is not the final solution.
     
  3. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    have you tried using the tracked pose driver? are you starting your "hands" at a non 0,0,0 position?
     
  4. hardcodednumber

    hardcodednumber

    Joined:
    May 26, 2014
    Posts:
    88
    I tried creating a new object and tracked just my left hand. The position was still off by about (2,1,0)
     
  5. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    For anyone who finds this later, like I did, I had this happen when my camera's starting local position (and rotation) weren't zero'd out, even though my left and right hands were. Everything was fixed for me when I started everything at 0,0,0 all over the hierarchy.
     
    StayTalm_Unity likes this.
  6. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    @hardcodednumber
    I think @laeusnb could be onto something, it's a very common pitfall.

    Can I see your hierarchy? Is the local space of your camera and the local space of your hand the same world space?
     
  7. hardcodednumber

    hardcodednumber

    Joined:
    May 26, 2014
    Posts:
    88
    hmmm. I'm working on a new ECS project. I'll see if I can dig it up
     
  8. hardcodednumber

    hardcodednumber

    Joined:
    May 26, 2014
    Posts:
    88
    @StayTalm_Unity here is my hierarchy, however; I am not doing VR anymore so I can't give you any real time values
     

    Attached Files: