Search Unity

Question Issues with syncing OVRPlayerController with HMD location in room scale.

Discussion in 'VR' started by ez9002, Oct 13, 2021.

  1. ez9002

    ez9002

    Joined:
    Mar 21, 2019
    Posts:
    7
    I've been running into countless issues trying to get the HMD location to sync with the character controller (as my teleport location, and rotation functions rotate the center of the character controller, which the HMD can get offset from in roomscale). I'm using the Oculus OVR player controller.
    My pseudocode basically looks like this:

    Code (CSharp):
    1. void Update() {
    2.     OVRPlayerLocation = (currentLocation.x + offset.x, currentLocationY, currentLocation.z + offset.z);
    3. }
    4.  
    5. Void LateUpdate() {
    6.     Offset = currentHMDLocation;
    7. }
    I'm getting the currentHMDLocation by getting the local position of the centerEyeAnchor, which follows the headset in roomscale.

    But the player is instead sliding around the map until they hit a wall, often at very high speeds. I think this could be an issue with the player collider pushing the player back (an issue I had when I was implementing teleportation), but my solution there, where I would disable then re-enable the player character controller, doesn't work here.

    I've been stuck on this issue for days and haven't been able to find a solution that doesn't involve switching to the XR rig, which isn't an option for this project unfortunately. Can anyone point me in the right direction?