Search Unity

Bug Orientation is off when re-centering on Oculus Quest after teleporting the player.

Discussion in 'XR Interaction Toolkit and Input' started by rytalfo, Sep 24, 2020.

  1. rytalfo

    rytalfo

    Joined:
    Jan 15, 2019
    Posts:
    5
    I am using the XR Interaction Toolkit with the Oculus Plugin in Unity 2019.4, building to the Oculus Quest.

    To teleport the player, I use:

    XRRig.MoveCameraToWorldLocation(Vector3 desiredWorldLocation) to set their position, and

    XRRig.MatchRigUpCameraForward(Vector3 destinationUp, Vector3 destinationForward) to set their rotation

    This works all well and good. However, if the player attempts to re-center themselves by simultaneously holding the oculus button and the menu button, their position is indeed re-centered on the last teleportation position (which is what I expect), but the orientation (rotation) is off 100% of the time. The player always seems to be rotated ~100 degrees to the left of the intended forward vector. Repeated re-centers afterward do not add additional rotation but continue to reset to this incorrect orientation, instead of matching the up and forward vectors specified in the function.

    A workaround might be:
    1.) figure out exactly how many degrees off a post-teleport re-centered pose is from the initial teleport pose
    2.) hard code this value and compensate for this upon teleporting
    3.) after teleporting, rotate the player back x degrees to face the intended direction, thereby fooling future re-centers into actually having the player face the intended direction.

    Tomfoolery and trickery to be sure. Is there any way I can avoid writing this silly code? Am I missing something?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I teleport the player by simply assigning a new transform.position to the XRRig. Maybe you could try that rather than those XRRig calls above?
     
    gjf likes this.
  3. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey there, after speaking to the team they'd like to see you report a bug report for this!

    Going to move this to the XR Interaction Toolkit forum as well!