Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
xhonzi's avatar
xhonzi
Honored Guest
12 years ago

Tracking Head and Body

All,
I have head tracking working in a Unity project of mine. I've been thinking of using the hydra (Teddy's scripts, or something else) for body tracking, and it made me realize there's a little problem there to solve.

In my project, the OVRCameraController is the child of the PlayerController. The PlayerController handles turning of the body/feet and the OVRCC handles rotation of the view/head as some degree offset of the player body.

Without body tracking, the player's real body is always facing the keyboard/hydra receiver, and the head is +/- degrees off of that vector. Easy enough. The player's virtual body is turned via the controller/mouse/whatever, but their real body is homed to the keyboard, so we always know what forward is. If the head is looking 20 degrees to the right (of the keyboard), and the virtual body - whatever the rotation of the body now is, the head is still 20 degrees to the right.

However, if we use a body tracker, then the rotation of the head needs to be relative to the body rotation and no longer the keyboard. If I turn my head 20 degrees to the right, and then turn my body to match that vector, but without turning my view... then my body has rotated 20 degrees and what's actually happened is that I've rotated my head 20 degrees to the left. But the rift tracker wouldn't pick that up. Since I haven't moved my head in 3D space (just the relationship betwixt my head and my body) the rift tracker still assumes I've turned my head 20 degrees off of the player vector, which is also 20 degrees to the right, putting my head at 40 degrees to the right.

All of that to say that we can't use the raw tracking from OVR anymore. We need to subtract the body tracking vector from the head tracking vector if it's going to make any sense.

Has anyone taken a stab at all of this? I haven't messed with Teddy's scripts yet, but perhaps he already solved that. Where is that guy, anyways.

4 Replies

  • Could it work if you used a different PlayerController (i.e the Unity First Person Controller) and didn't link the FollowOrientation parameter? I believe this would allow the body and head to be independent.
  • xhonzi's avatar
    xhonzi
    Honored Guest
    "cybereality" wrote:
    Could it work if you used a different PlayerController (i.e the Unity First Person Controller) and didn't link the FollowOrientation parameter? I believe this would allow the body and head to be independent.


    You'd still want them to be linked for anything else that turns the player- right? I'm primarily thinking of controller/keyboard/mouse/whatever if you have a set up that doesn't really allow for unlimited rotation (i.e. anything with cords) and anything else that rotates the player- physics etc.

    But you're right- I wasn't fully considering unlinking the FollowOrientation parameter.
  • Yes, if you wanted (for example) a gamepad to rotate BOTH the body and the head, then you will need to do something custom for that. Really at that point you should just edit the OVRPlayerController to do what you need. It doesn't support it out-of-box, but the code is all there for you to tinker with.
  • makatu's avatar
    makatu
    Honored Guest
    I was thinking we should make the Oculus an outside experiance. Like you said, the player will never be fully in the worlds we create if they are pressing buttons. A player could mark off a 10 x 10ft square in their backyard and they could actually walk around in the VR world using the real world. A camera can be used with the Oculus to keep track of how far away the player is from the the boundaries. An idea :)