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.
  2. Dismiss Notice

Question Teleportation not functioning

Discussion in 'XR Interaction Toolkit and Input' started by BTKeevan, Jul 29, 2022.

  1. BTKeevan

    BTKeevan

    Joined:
    May 8, 2019
    Posts:
    12
    Unsure whether to tag this as "question" or "bug." Using Unity 2020.3.21f1 and XRI Toolkit 2.0.2. My XR origin has direct interactors on the left and right hands for picking up and interacting with objects, and I want to also set up left-hand teleportation. I have a left hand raycast interactor without a hand model on it, with its only interaction layer mask being "ground." Raycast should light up green whenever I'm pointing at the teleportation area with the same interaction layer mask "ground." Raycast does not light up green when I'm pointing at the ground. I don't know why this has happened, or what I need to change in order to solve this issue.
     
  2. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    I'm guessing that your XR Ray Interactor is hitting another collider which is blocking the Teleportation Area from being hit. Try opening the Window > Analysis > XR Interaction Debugger to see if the Teleportation Area is showing up in the Valid Targets list to verify that it's the closest thing being hit. If it's blank, it's probably hitting something else. If you have another GameObject for the ground that is not teleportable, you may need to raise the Teleportation Area up some so it's closer and not blocked by the ground.

    You may also need to adjust your Raycast Mask on the XR Ray Interactor and the GameObject Layer of the Teleportation Area to allow it to be hit. The Physics.Raycast call it does needs to be able to hit the object, so the layer has to be in the mask.

    You may need to set Raycast Trigger Interaction to Ignore if its hitting an invisible Trigger collider instead of the Teleportation Area.

    If none of those help, you can call TryGetCurrent3DRaycastHit to get the RaycastHit and
    Debug.Log
    what collider you are hitting.
     
  3. starwalkerluke_lu

    starwalkerluke_lu

    Joined:
    May 5, 2023
    Posts:
    2
    That's cool, problems solved