Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

XR Interaction - Teleport rotation issue

Discussion in 'XR Interaction Toolkit and Input' started by Aurecon_Unity, Feb 14, 2020.

  1. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    We seem to have found a bug in the XR Interaction teleport system - if the Teleport Area object has a rotation applied, this rotation is applied to the viewer after a successful teleport.

    In our instance, we deal with CAD models from 3Ds Max, exported into Unity as FBX. By default, Unity will apply rotation on these objects (in our case it is a -90 degree rotation on the x axis), but this means that when we try to teleport, it applies a -90 rotation to the XR rig (although it's on the Z axis, not X).

    Has anyone encountered this? I've filed a bug report - Case 1219563.
     
  2. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    Make sure that the "Match Orientation" of the Teleportation Area component is set to None. if it's set to camera, we'll rotate the camera to match the orientation of the area!
     
  3. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Hi Matt, this doesn't actually change the behavior that we're seeing.
     
    Matt_D_work likes this.
  4. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    Ill have a look at the bug, but curious. as with that set to none it shouldn't modify the camera's rotation at all.
     
  5. Gerald-Ferreira

    Gerald-Ferreira

    Joined:
    Oct 21, 2014
    Posts:
    2
    I am having the same issue. In Teleportation Area script my Match Orientation is set to None. When I teleport the XR Rig Rotation X gets set to --90. I also imported a model with a floor area which is rotated by -90 degrees (this is how it was modeled) - and the XR rig seems to inherit this on teleportation. If I set the floor Rotation to 0 it works correctly. But it means I have to do a lot of changes to my model to re-import it into unity with Rotation set to 0
     
  6. Gerald-Ferreira

    Gerald-Ferreira

    Joined:
    Oct 21, 2014
    Posts:
    2
    Did you find a solution to the problem?
     
  7. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    As an update, I sent Unity a small test case and they have confirmed there is an issue - hopefully a fix will come soon.
     
  8. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    Looks like the problem is that we're aligning the up vector of the camera with what we consider the up vector of the object. hence the rotation.

    we're going to add a way to not align up vectors. but you might get more mileage by making sure your exported assets have the same handed co-ordinate system so you dont have any further issues :)
     
  9. natelive

    natelive

    Joined:
    Feb 27, 2020
    Posts:
    2
    I believe i am using Unity 2019.2.5f1 as that’s what was recommended to me (until this problem it was working as planned). The problem doesn’t effect my project badly enough that it isn’t ‘playable’, just limits the users movements.
     
  10. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Thanks Matt, the workaround that Jack from Unity suggested works for us - adding the Teleport Area component to the parent object rather than a child gameobject.

    Sounds good, but this is using the inbuilt behaviour of a 3ds Max to Unity FBX export process - I'd hate to think we'd need to add additional authoring steps in 3Ds Max to cater for the weird FBX import behaviour :(
     
    kalibcrone likes this.
  11. Jules86

    Jules86

    Joined:
    Jan 22, 2013
    Posts:
    1
    Hi all, we've had the issue of teleporting to rotated surfaces too. The easy solution right now is to edit the XR TeleportArea.cs script file, and change:
    Code (CSharp):
    1. teleportRequest.destinationUpVector = transform.up;
    to
    Code (CSharp):
    1. teleportRequest.destinationUpVector = Vector3.up;
    I'd actually recommend making your own TeleportArea class and then to override the GenerateTeleportRequest function to use world axes instead of the transform axis (then you won't be editing XR scripts directly. Here's our edits:

    Code (CSharp):
    1. namespace UnityEngine.XR.Interaction.Toolkit
    2. {
    3.     public class Teleport_WorldArea : TeleportationArea
    4.     {
    5.         // Override the teleport request to use the world rotation and not our gameObject's transform
    6.         protected override bool GenerateTeleportRequest(XRBaseInteractor interactor, RaycastHit raycastHit, ref TeleportRequest teleportRequest)
    7.         {        
    8.             teleportRequest.destinationPosition = raycastHit.point;
    9.             teleportRequest.destinationUpVector = Vector3.up; // use the area transform for data.
    10.             teleportRequest.destinationForwardVector = Vector3.forward;
    11.             teleportRequest.destinationRotation = Quaternion.identity;
    12.             return true;
    13.         }    
    14.     }
    15. }
    16.  
     
    Last edited: Apr 9, 2020
    Boudewijn likes this.