Search Unity

How can I get a body mesh to correctly follow the OVR rig?

Discussion in 'AR/VR (XR) Discussion' started by MrLeggo, Aug 6, 2019.

  1. MrLeggo

    MrLeggo

    Joined:
    Feb 16, 2018
    Posts:
    20
    I'm trying to get my own custom body mesh (not the Oculus Avatar) to move and rotate correctly with the OVR rig.

    Is there an easy way to do this? I've tried a few things but keep running into issues.

    If I place it under the centre anchor, it sort of works, but I have to stop the rotation on 2 axis and this seems to end up with it rotating on the correct axis but with a weird offset, rotation around another point.

    If I use a script to match to match the position and rotation, this sort of works, but the rotation follows the head, which isn't always correct. It needs to rotate with the 'body' (if we turn our head our body does not necessarily follow).

    Now there is no body in the rig, just the head and hands. I'm sure someone far smarter than me can figure out a way to approximate if the body has turned based on a correlation between the head and the controls, but I think that might be beyond my skills.

    But is there a much simpler way? Has anyone else achieved this? I can't imagine I'm the only one!
     
  2. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    147
    there's no way to really know for sure if the body is turned or not anyway without a tracker so most games let you rotate with the controller for instant changes and to deal with smaller changes what i normally do is just link it to the head's Y rotation but do it on a lerp so the body turns slower than the head - then if the player just quickly looks around the body doesn't really change much but turning to a certain direction for a longer period means the body will still update... though i don't know if there isn't a better way, i didn't spend much time on it, just wanted something quick and believable :)
     
    MrLeggo likes this.
  3. MrLeggo

    MrLeggo

    Joined:
    Feb 16, 2018
    Posts:
    20
    Thanks Gary, yeah I did consider doing something similar. I'll give that go.