2

I am new to Unity and VR. I am working on a VR app using the Oculus Quest. I have set up a teleportation system based on the following tutorial video by Valem: https://www.youtube.com/watch?v=r1kF0PhwQ8E - but find that when I turn my head or use the thumbstick to oriented during teleportation, after landing I can be facing sideways and any further movement using the thumbstick appears to be incorrectly aligned - so when you try to move forwards you move sideways etc.

I presume my camera rig (which is a child of the OVRPlayerController) is facing the wrong way. This is backed up by the fact that some text I've placed in front of the rig appears to have shifted to the side instead of straight up front.

I just want a simple teleportation system so you move to the new location but do not orientate - instead you remain facing in the same direction as you started.

Is it possible to disable orientation? Or are there any recommended alternative solutions for a teleportation system?

1 Answers1

0

i used this workaround to remove teleport orientation:

  • open TeleportDestination prefab

  • delete the orientation gameobject

  • hit play, then fix those scripts that referenced it

  • you'll also end up inside LocomotionTeleport.cs DoTeleport(), where it seems to set that teleport rotation (so probably enough if modify code here)

      public void DoTeleport()
      {
          var character = LocomotionController.CharacterController;
          var characterTransform = character.transform;
          // removed orientation
          //var destTransform = _teleportDestination.OrientationIndicator;
          var destTransform = _teleportDestination.transform;
    
          Vector3 destPosition = destTransform.position;
          destPosition.y += character.height * 0.5f;
          // removed orientation
          //Quaternion destRotation = _teleportDestination.LandingRotation;// destTransform.rotation;
        #if false
          Quaternion destRotation = destTransform.rotation;
    
          //Debug.Log("Rots: " + destRotation + " " + destTransform.rotation * Quaternion.Euler(0, -LocomotionController.CameraRig.trackingSpace.localEulerAngles.y, 0));
    
          destRotation = destRotation * Quaternion.Euler(0, -LocomotionController.CameraRig.trackingSpace.localEulerAngles.y, 0);
      #endif
          if (Teleported != null)
          {
              //Teleported(characterTransform, destPosition, destRotation);
              Teleported(characterTransform, destPosition, characterTransform.rotation);
          }
    
          characterTransform.position = destPosition;
          //characterTransform.rotation = destRotation;
      }
    
mgear
  • 1,333
  • 2
  • 22
  • 39