How to Teleport in Unity VR with XR Interaction Toolkit

Sdílet
Vložit
  • čas přidán 16. 07. 2024
  • It's what we've all dreamed about since we were kids. What would it be like to teleport? Use Unity's new input system combined with the XR Interaction Toolkit. This method of VR locomotion is just a blip away!
    Hey, devs! Teleportation is one of the primary methods of locomotion in VR games. XR Interaction Toolkit has a preset teleportation option, but honestly....it's garbage. So in this video, we will fix the default actions to resemble something more game-ready! Oh, and there's a challenge 😉
    📺 Watch Next: • What Do I Need to Beco...
    🥽 Enroll in the (now FREE) VR Creator Academy: skool.com/vrcreatoracademy
    ⌚ Timestamps
    0:00 Subscribe!
    0:13 Setup XR Rig
    2:12 Teleportation Locomotion System
    3:10 Teleportation Area vs Anchor
    3:58 Testing the Default Teleport Method
    5:08 Update Line Visuals
    6:21 Sweet Sweet Code
    15:08 My Challenge to YOU
    17:10 Testing
    17:57 Like!
    19:00 Comment!
    #vr #teleportation #unity

Komentáře • 212

  • @JustinPBarnett
    @JustinPBarnett  Před 3 lety +5

    Download the Project (for FREE): www.vrcreators.io/codedownloads

    • @riverboatgambler3401
      @riverboatgambler3401 Před 12 dny

      Great video. I'm following you now. You do an amazing job. The code download link is dead though. Also, your picture during the coding obscures some of the code you write. This is really a problem when you're typing literal strings (as in the case of the action maps). Thanks!

  • @cirelachlan
    @cirelachlan Před 2 lety +1

    Best part of the video was admitting you couldn't figure out the rotation. Your video is helping me a lot with my project and seeing someone humble about learning and their knowledge is awesome.

  • @MatanNaveh
    @MatanNaveh Před 3 lety +9

    Hey, your channel just got recommended for me and I have to say that I'm only 10 minutes in and I'm really impressed!
    I can see you put a lot of work and effort into these videos and I know that if you'll keep uploading that often your channel will be very known.
    I like the camera and the lights behind it and it's really given me a studio and professional feeling.
    Right now I don't have a VR headset but I'm planning on buying one soon.
    Keep up the great work man, I appreciate your effort,
    Matan.

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      Wow, I really appreciate all the praise and encouragement Matan! Thanks so much! (And getting a VR headset is SO fun!)

  • @tczhou9969
    @tczhou9969 Před 3 lety +18

    For anyone who wants to make the function working on the right hand instead., here are the steps:
    1. In the script, change the "XRI LeftHand" to "XRI RightHand"
    2. [Important] Make sure the XRI RightHand's "Move" action is not empty, if there is no action relates to it, click on the + button and choose "Add binding". In the path, choose "Primay2DAxis [RightHand Controller]".
    (By default, there is no move action in the Right Hand controller, if you don't add the Move action, the `_thumbstick.trigger` is always falsy, and as a result, the teleport beam will stay active and cannot be cancelled by releasing thumbstick.)
    3. Drag the right hand raycaster to the script

  • @ishakgamingspider8743
    @ishakgamingspider8743 Před 2 lety +4

    Your channel is very cool man I didn't know anything about vr but when I found your channel my life changed❤

  • @fateshow5303
    @fateshow5303 Před 2 lety +1

    Great videos, sending my support, keep doing what yr doing yr great!

  • @azataiabylbek5262
    @azataiabylbek5262 Před 2 lety

    Thank you Justin^^ You're awesome~

  • @shanghai752
    @shanghai752 Před rokem +3

    Hello Justin! Your video is amazing and easy to understand!
    Here are my tips:
    First,the XR interaction tookit has updated and the action map has changed;
    The input actions like “Teleport Mode Activate” and "Teleport Mode Cancel" have been moved to the XRI LeftHand Locomotion.
    Secondly, I found the teleportion does not go as well as I expected : When I release the thumbstick , I found myself teleported to somewhere else instead of the XR ray hit point.
    Finally ,I found that the rayInteractor.enabled and _isActive should be set false after the method QueueTeleportRequest being excuted.If you don't do that, the teleportation method may be excuted many times during the time the thumstick returning back to the origin.
    Thanks a lot!

  • @gtxo2104
    @gtxo2104 Před 3 lety +3

    these vr tutorials are very cool I have to say. I am making a spiderman game, imagine how sick that would b in VR

  • @Andrew-he5gj
    @Andrew-he5gj Před 2 lety +1

    Great tutorial !

  • @vitchi
    @vitchi Před rokem

    Thank you for the cool video!
    I came here to see if I could figure out how to add a cool-down to the teleportation because I would like the user to take in the environment before moving on too quickly but I couldn't quite figure it out. Should I use some sort of timer in combination with the provider.QueueTeleportRequest() for this or do you have any other idea?

  • @danread1217
    @danread1217 Před 2 lety +3

    Nice tutorial, and demonstrates the logic by linking input to action. Quick question- why wouldn't you use a Player Input component to isolate the control action and use it to broadcast to your methods in the Teleportation Manager? That removes the need to hard-code a controller input and gives more flexibility further down the line (which is what the new Input System aims to do).

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      That's actually a really great suggestion! Should work pretty good

    • @danread1217
      @danread1217 Před 2 lety

      @@JustinPBarnett Yep- works an absolute treat! Will write it up when I get 5 minutes...

  • @TwistdRabbit
    @TwistdRabbit Před 2 lety

    Hey Justin, awesome tutorial as always, got an issue, i managed to get everything working but the reticle wont appear when i add it, any ideas?

  • @Atlar
    @Atlar Před 2 lety

    I really liked the tutorial it was easy to follow and easy to implement.
    Not sure if anyone proposed a solution but I did manage to get the facing issue resolved. Not sure if it's the best solution but it does work.
    I created a standalone GameObject to use as a recticle. I gave the object an obvious "front", enable, and place it at the hit point whenever the rayInteractor "isActive".
    There's a little math to convert the 2d axis into a rotation angle
    Vector2 directionVec = thumbStickAction.ReadValue();
    float angle = Mathf.Atan2(directionVec.y, directionVec.x) * Mathf.Rad2Deg;
    landingReticle.transform.rotation = Quaternion.Euler(new Vector3(0, -angle, 0)); // This is assuming you're rotating around the Y axis.
    Some minor adjustments to align the objects "forward" with the angle you have to add 2 lines to the teleportRequest code.
    teleportRequest.matchOrientation = MatchOrientation.TargetUpAndForward; //

  • @sebastien4507
    @sebastien4507 Před rokem

    In my case i kept teleporting, so I managed to fix it when you disable the rayInteractor and isActive variable at the end of your update

  • @JustPhil
    @JustPhil Před 2 lety +4

    ich like your stuff a lot...thx!! one suggestion: your cuts are often very fast, so that i can almost not follow what you are doing.. a little little bit slower might be better :)

  • @andreigtx1711
    @andreigtx1711 Před 2 lety

    Hello Justin! I am currenty using your tutorials for my bachelor's degree and I have a problem with this part. I followed your tutorial to animate hands beforehand and after doing this tutorial my rays do not cast anymore and I cannot teleport. Is there any solution for this, or did I mess up something? I am also seeing that my Line Renderer associated to my controller automatically disables itself when I enter play mode. Thanks in advance!

  • @olivername
    @olivername Před rokem

    hi I got issue where the rays don't work and the move on controllers could you please help thanks

  • @greg2fs
    @greg2fs Před rokem

    I don't see the problem about setting the rotation about the thumbstick position, just save the thumbstick vector2 when it' is greater that 0.9f for example, and calculate the rotation with that

  • @curtisturpin9389
    @curtisturpin9389 Před 2 lety +1

    Here's the solution I found for the Rotation problem you ran into:
    I use a game object as the "Reticle" for the XR Ray Interactor > XR Interactor Line Visuals.
    I then use the joystick input, find the direction based on the Vector2 and the Transform of the controller being used >
    ```Vector3 joystickDirection = controllerTransform.right * joystickRotationValue.x + controllerTransform.forward * joystickRotationValue.y;```
    after this, you want to 0 out the Y coordinate of of joystickDirection.y to keep the reticle flat against the ground.
    ```joystickDirection.y = 0```
    I also normalized the joystickDirection, but I don't think it's necessary
    I then use that to rotate the Reticle >
    ```Quaternion newRotation = Quaternion.LookRotation(forwardDirection, Vector3.up);
    reticleTransform.rotation = Quaternion.RotateTowards(reticleTransform.rotation, newRotation, 10000 * Time.deltaTime);```
    Then in the Teleport Request >
    ```destinationRotation = new Quaternion(0, Mathf.Round(reticleTransform.rotation.y), 0, 0),
    matchOrientation = MatchOrientation.TargetUpAndForward```
    Essentially, serializing the rotation of the joystick inside the Tranform of the reticle and applying that during the teleport request.
    I'm currently running this under the Update method, but only if my teleporter is currently active. I'm looking to find a way to get this out of Update() so it's not checking for an if statement every frame.

  • @russellgilbertdecastro7031

    Hmmm I feel like I've seen this guy... great content!

  • @mrstruijk
    @mrstruijk Před 2 lety +17

    Hi Justin! Thanks for the tutorial, that really helped me along. One thing that didn't work out for me was that my teleportation happened pretty much instantaneously. The 'thumbStick.triggered == true' did not behave as expected. To fix this, I first created a new action for the Primary2DAxis, which I set to 'Value' and 'Vector2' as the Control Type. I then referenced that action instead of the Move action in the code, and used 'if (thumbStick.ReadValue() != Vector2.zero) { return; }'. This worked for me, I hope someone else finds it useful too.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Glad you got it working!

    • @jacobclaytor5999
      @jacobclaytor5999 Před 2 lety

      Thank you very much for this. I could not figure it out the for the life of me. Another thing I did was got rid of the isActive boolean. Since we are already toggling rayInteractor enabled/disabled, just check that boolean to simplify the code a bit.

    • @parse_error
      @parse_error Před 2 lety

      Thanks! I spent 1h trying to find why my thumbstick wasn't staying on triggered state (had the problem only in build, not in editor) and your solution worked for me ;)

    • @eTxsicWtKUEbBwaQicQJuOPKgW
      @eTxsicWtKUEbBwaQicQJuOPKgW Před 2 lety

      OHHHHHHHHHHHHHHHHHHHHHHHHHHH IT WORKS PREFECTLY!

    • @winn8888
      @winn8888 Před 2 lety

      Same thing here - thank you for this excellent solution. I didn't even need to set up a new input action, I just left the reference to the existing Move action and used your code in the update loop and it sorted the issue for me.

  • @lop258
    @lop258 Před 2 lety +1

    Hi Justin, how would you create teleportation area on complicated meshes, such as it is in walkabout mini golf or Star Wars Tales from the Galaxy Edge?

  • @olivername
    @olivername Před rokem

    I have done this but the line is not always on the hands in middle of the plate

  • @CrossTwnAuto
    @CrossTwnAuto Před 2 lety

    Hi Justin, i was trying to setup the teleportation and i am using a plane because i made a room in probuilder and inverted the uvs of a cube to make it so i can't use it for the teleportation zone. when i press the trigger to move and then release to choose where i want to teleport i shoot across the room and im unable to get to a specific location like in the middle of the room can you try help? thanks!

  • @jakewarr6942
    @jakewarr6942 Před 2 lety +1

    Hi Justin, thanks for the tutorial. Do you plan on making an updated tutorial for Unity 2021, It looks like some of the API's have changed and this no longer works :( also in future videos showing the full line of code and going a bit slower when creating the variables/autofilling would really help out a lot.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      I definitely need to make an updated teleportation video

  • @tannersmith8050
    @tannersmith8050 Před 2 lety +2

    Hey Justin. Any recommendation for if we'd like to track the number of times a user has teleported using the Locomotion System? I tried adding code to the base Teleportation Provider, but that ended up being immutable and reverting. If I wanted to create a TeleportationManager script like you did, how would I determine when my new "teleportationCount" variable would need to be incremented? (i.e. how could I track when the XR Origin was successfully teleported.) Thanks in advance!

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      You'd have to override the teleport method and add a counter to it

  • @lovelymammoth
    @lovelymammoth Před 2 lety +1

    Hello Justin,
    Thank you for this amazing tutorial!
    One question though, because I am a complete beginner to coding: in visual studio 2019, although the predictions work, the visuals are different to your in the tutorial. is there some integration settings that I have to implement in my options?

  • @EchteTuber
    @EchteTuber Před 2 lety

    Looking forward to your updated video. Followed the this tutorial and manipulated it to my liking. But the right hand controller is still active too! It teleports on grip release, which is super annoying because I'm using the right controller to interact with grabbables. If I don't point at a grabbable I get teleported. In the XRI RightHand Locomotion action map I removed all the Bindings from the Actions (Teleport Select, Teleport Mode Activate and Teleport Cancel) in the XRI Default Input Actions...

  • @pozlong8614
    @pozlong8614 Před 2 lety +1

    Super clear and helpful! I got this one and the hands to work but now my grabbables are no longer grabbable. What do you think I broke?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety +1

      Are all the layers set correctly and not conflicting?

    • @pozlong8614
      @pozlong8614 Před 2 lety +1

      @@JustinPBarnett Thanks for the reply & good question! It might have something to do with the models I downloaded (temp models) for the scene. When I use a basic sphere I can grab via the ray, ideal case I could grab with the hands from previous tutorial. I'll have to try it with the real models once I get them.

  • @knightcube
    @knightcube Před 2 lety +1

    Great video! How do I teleport using Eye Gaze Interaction?

  • @alo2a7eta
    @alo2a7eta Před 2 lety +1

    Thanks for the great tutorial. I have a weird behaviour on my project. the teleportation is a bit far than expected although the teleportation area is not that wide. do you know what might be the reason for that?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      You can decrease the length of the raycast if you don't want the player to teleport as far

  • @sakunamadushanka6382
    @sakunamadushanka6382 Před 2 lety +1

    Hi Justin, Thank you for the great tutorial. This have an small issue, When you try this on a plane without "Teleportation Area" Script attached, instead include teleportation anchors, movement is bit weird and it does teleport within that plane without the "Teleportation Area" script. Also this does cause positioning issues when we teleport into anchors. Can you suggest solution to fix this? Thank you in advance!

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Teleporting onto anchors will move the player to that exact spot. It's different than a teleportation area. If you're still having issues join the Discord and we can help you troubleshoot in #dev-help!

  • @user-kj1fq8vn8f
    @user-kj1fq8vn8f Před 2 lety +1

    Thanks for the tutorial. I have a question that if I use the Teleportation Manager script in the video, I can teleport to the area which does not have "Teleportation Area" script. However, my expectation is to teleport only on teleport areas, so could you give any suggestions to solve this problem?

  • @lacoors
    @lacoors Před 3 lety +4

    Just a question if i try to teleport outside of the plane i get a red ray and the code prevent me to do it just like u show it in the video. But if we add a cube or bowling alley ;) over the plane and don't add a teleportation area to it. Even if i get a red ray when i pass over it when i realease the thumbstick it will teleport me on that area anyway any clue why ???

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +3

      Oh I think I forgot to add a check on the hit.gameobject for a teleportation area! You’ll need to add that and determine if you can teleport on not using that. Good catch!

    • @lacoors
      @lacoors Před 3 lety +2

      @@JustinPBarnett Thanks for the advice i have modify the test in the update for :
      if (!_rayInteractor.GetCurrentRaycastHit(out RaycastHit hit) || hit.transform.GetComponent() == null)
      {
      _rayInteractor.enabled = false;
      _isActive = false;
      return;
      }
      and now it work. I can't teleport on a non teleportable area. Non sure it's the best way to do it but it worked :)

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      @@lacoors Yup! good catch & solution

  • @rodrigo.cs.machado
    @rodrigo.cs.machado Před rokem

    hello, I have a small problem involving teleportation. I'm instantiating the player in the scene because the phase is a multiplayer one, however the "teleportation area" script that is on the ground for the use of the teleport only recognizes the "teleportation provider" script of the player if he is already in the scene when the player comes. how to solve it? I already tried dragging and dropping the script directly from the prefab to be instantiated but it didn't work...

    • @timpixel3679
      @timpixel3679 Před rokem

      You could set the references inside the start method of the Teleportation Manager that was created here. This is just an example for one teleport object, if you have multiple areas or anchors you need to do some kind of loop.
      void Start()
      {
      var teleportArea = FindObjectOfType();
      teleportArea.teleportationProvider = GetComponent();
      // here comes the other code from this tutorial
      }

  • @hansshadow360
    @hansshadow360 Před 2 lety +2

    Hi, i do this tutorial. But my Unity editor not response to oculus controller click... you know any solution? Unity can track the controls movement but for example i cant teleport with buttons in my unity editor.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Join the discord and we can help you troubleshoot!

  • @xZeroCCx
    @xZeroCCx Před 3 lety +2

    Random guess, but to get the rotation for the teleport couldn't you disable the snap turning while the teleport is active, and use the right hand to handle your teleport rotation?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +3

      That's a possibility, but I'd love to be able to use the same stick I'm using to teleport to also set the rotation.

    • @xZeroCCx
      @xZeroCCx Před 3 lety

      @@JustinPBarnett Hmmm, Does your thumbstick have a "Middle click" so instead of teleporting on releasing the stick you could teleport on clicking it, and track the rotation before clicking.
      Or like enter tp mode by moving the stick, use the stick to rotate and then pull the trigger to finalize the tp.

    • @xZeroCCx
      @xZeroCCx Před 3 lety +2

      Firing the TP on stick release works, but unless you find an invalid target there isn't a way to cancel our teleport right?

    • @Ariel16283
      @Ariel16283 Před 2 lety +1

      @@xZeroCCx There is a game called Fuji on the quest, they set up the controls so you can teleport with both sticks, but if you are teleporting with one and try to start to teleport with the other it just cancels the current teleport.

    • @Ariel16283
      @Ariel16283 Před 2 lety

      I actually think it is more natural to have the teleport on release of the sticks. Pretty much the majority of the VR games have it implemented like this, so thats what people will expect.

  • @BonCreations
    @BonCreations Před 3 lety +3

    Awesome tutorial! This is really helping with my coursework for my Uni. However, I've encountered a problem where the error code is the following:
    NullReferenceException: Object reference not set to an instance of an object
    TeleportationManager.Start() (at Assets/TeleportationManager.cs.20)
    I've checked the code on line 20 and it seems that it was this line "var activate = actionAsset.FindActionMap("XRI LeftHand").FindAction("Teleport Mode Activate");" that Unity wasn't liking. Been trying to solve this for over an hour by going through the tutorial and still no results. Any advice?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +1

      Do you have an action of that name set up?

    • @BonCreations
      @BonCreations Před 3 lety +1

      @@JustinPBarnett If you are talking about the names for the action e.g. InputActionAsset actionAsset, then yes!
      Somehow the error didn't show up anymore but have encountered another problem, where the teleportation ray doesn't appear at all when I try to pull the thumbstick towards me or the opposite direction. Perhaps it might be easier if I just post a screenshot of the code that I've copied from yours and see if there is any error... Sorry for the inconvenience!
      i.imgur.com/YC11vSB.png

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      @@BonCreations I’m starting to think that you didn’t set something in the inspector. Like for got to attach the action asset in its slot in the teleportation manager. Your code looks fine as far as I can tell

    • @BonCreations
      @BonCreations Před 3 lety +1

      @@JustinPBarnett I also have completed that step by dragging the XRI Default Input Actions to the slot. Thought it would be worth mentioning, is that I have also followed the continuous movement tutorial that you have uploaded before and I tried to combine both of them together.
      I was wondering if the continuous movement tutorial that I also followed and applied to the same XR Rig before might be the reason for the error?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +1

      @@BonCreations hmmm so you’re trying to use continuous movement and teleportation at the same time?

  • @DanielSantallaa
    @DanielSantallaa Před 3 lety +1

    The ray casted from the hand is rotated 90 degrees on the Z axis. Any idea of how to correct this?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +1

      Try creating an empty game object as a child of each controller and rotate that to where you like it. Then you can move the ray interactor and line renderer component to the child object and that should work.

    • @DanielSantallaa
      @DanielSantallaa Před 3 lety +1

      @@JustinPBarnett thanks!

  • @chills_20
    @chills_20 Před 3 lety +2

    can you teleport without the VR Headset and just mouse-click around? Also, how can I save this as a phone or website for people to access?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      Yea I'm sure it's entirely possible to do with a FPS or 3PS style game. Not sure what you mean by save as a phone or website though? Can you elaborate?

    • @JayPatel-sw2fh
      @JayPatel-sw2fh Před 3 lety

      @@JustinPBarnett means, how we can test this VR Game in Mobile that you are testing in game panel in unity.
      Also do we need VR Headset to teleport it?

  • @connormarkus8398
    @connormarkus8398 Před 3 lety +1

    Why does the XR Rig have to be at 0, 0, 0. What should i do if i am trying to play from a different location?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +3

      It doesn’t have to be! You can start from anywhere. That was just me being OCD 😅

  • @matiaspina2323
    @matiaspina2323 Před 11 měsíci +1

    I found this comment below "This teleportation method has nice behaviour in the editor, but in the android build, teleportation happens immediately when I press the joystick" Anyone found the solution? Thanks!
    Your videos are amazing, help me a lot!!

    • @jakehartnoll6625
      @jakehartnoll6625 Před 11 měsíci

      I'm having the same thing - I had this working 2 weeks ago and then I come back to my project this week and I'm getting this happen now

  • @ArendRaifsnider
    @ArendRaifsnider Před 3 lety +2

    Thanks for these tutorials. I'm able to get the raycast to come out and the grip to deactivate it but releasing the thumbstick doesn't do anything - the ray just remains cast and it doesn't teleport. The only difference I'm able to see in the script is that Unity made me update GetCurrentRaycastHit to TryGetCurrent3DRaycastHit. Any thoughts on what I might be missing?

    • @Breyyne
      @Breyyne Před 2 lety

      As far as I've been able to tell, GetCurrentRayCastHit still works. Though I am trying to figure out a Flicking issue with my Ray. Are you sending the TeleportQueueRequest? Just switch over to TryGetCurrent3DRaycastHit and it seems to be working out for me.

    • @ArendRaifsnider
      @ArendRaifsnider Před 2 lety +2

      @@Breyyne I made the switch to TryGetCurrent3DRaycastHit. I am sending the request. My Update function looks like this:
      void Update()
      {
      if (!_isActive)
      return;
      if (_thumbstick.triggered)
      return;
      if (!rayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit))
      {
      rayInteractor.enabled = false;
      _isActive = false;
      return;
      }
      TeleportRequest request = new TeleportRequest()
      {
      destinationPosition = hit.point,
      //destinationRotation = ,
      };
      provider.QueueTeleportRequest(request);
      rayInteractor.enabled = false;
      _isActive = false;
      }

    • @ArendRaifsnider
      @ArendRaifsnider Před 2 lety +1

      @@Breyyne Turns out it is working but not as expected. When I press the stick forward, the ray comes out but doesn't teleport me. If I hold the grip down and then push the stick forward, the ray comes out and teleports me.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Join the discord if you're still having issues and we can help you troubleshoot!

  • @lacoors
    @lacoors Před 3 lety +1

    This method works fine with Quest2 joystick or controllers with a joystick but is there a way to make this work with HTC Vive Wand Controller cause the Keypad auto teleport on pointing even if i dont release it. I can't find the way to put this on the KeyPad Press instead of Touch

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      You'll need to go into the Input Actions and find the HTC Vive Wand controller option and pick the specific input you want to use from that. So around 8:30 instead of using those action maps you can create your own specific one to use and map to.

    • @lacoors
      @lacoors Před 3 lety +1

      @@JustinPBarnett But is it possible to make both controllers work in same app ? Like is it possible in script to detect which system i am using and call the actions according to the headset ?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      @@lacoors Tbh I haven't found a good way to detect what controller is being used yet. It should be possible, but I'm not sure how

  • @shaynemcgregor1450
    @shaynemcgregor1450 Před 3 lety +1

    I ran into a null reference exception and it has something to do with the _thumbstick variable, but I don't know how to fix it
    NullReferenceException: Object reference not set to an instance of an object
    TeleportationManager.Update () (at Assets/TeleportationManager.cs:33)

    • @HairySeagull
      @HairySeagull Před 2 lety +1

      Yea what is going on? Did you fix it?

    • @sedatunali407
      @sedatunali407 Před 2 lety +4

      @@HairySeagull Make sure you didn't add var to the _thumbstick in the start method. I did at first by copying the activate and cancel variables above.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      👆

  • @mayadaaq711
    @mayadaaq711 Před 2 lety +1

    I followed everything exactly but I don;t seem to teleport to the hit point but flying so fast around!

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Join the discord and we can help you troubleshoot!

  • @yasarbaba2413
    @yasarbaba2413 Před 3 lety +1

    Hi Justin! I want to be teleported with the XR Interaction Toolkit using a button. (where ı want) It doesn't happen when I call TeleportAnchor for the button. How can I do it?

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      You'll have to call the teleport provider when your button is pressed and provide a location to be teleported to

    • @yasarbaba2413
      @yasarbaba2413 Před 3 lety +1

      @@JustinPBarnett Thank you💥

  • @Frowdy325
    @Frowdy325 Před 3 lety +1

    HI,
    Great tutorial.
    Everything works fine in unity itself, but when i build it to android device (quest2) it doesn't work correctly. When i'm pushing the thumbstick forward it teleports right away, without releasing the thumbstick.
    Any idea what the problem is?

  • @bluurayr
    @bluurayr Před 2 lety +1

    Am I missing something or how am I able to use the left hand to teleport and be able to grab objects at the same time?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Should be the same ray interactor, you'd just need to leave it on all the time (or make it visible when hovering over an interactable object)

    • @bluurayr
      @bluurayr Před 2 lety

      @@JustinPBarnett Thanks for the fast reply (and the Tutorial) :) Unfortunately I do not have any programming knowledge and do not know how to do this. I tried to copy part of the code from your VR Hands tutorial and I can't get it to work. So I will just accept that and will only grab with the right hand :D

  • @MEJHarrison
    @MEJHarrison Před 3 lety +3

    Great video! I'm still having one issue I can't quite solve. Mine seems to teleport immediately even while the joystick is stick being held. Any thoughts on where to look for that? I've double and triple checked the code, but can't track it down.

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +1

      Sounds like you're running the teleport action on stick pushed instead of stick released and put back to 0

    • @MEJHarrison
      @MEJHarrison Před 3 lety +1

      @@JustinPBarnett Sounds like you're talking about C# code. I've double and triple checked it. Even compared it to some code I found in a post below. The only differences were expected. I'm lost. Here's the bit of code I believe you're referring to. If you're talking about something else, I can't find it.
      void Update()
      {
      if (!_isActive)
      return;
      if (_thumbstick.triggered)
      return;
      if (!rayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit))
      {

    • @MEJHarrison
      @MEJHarrison Před 3 lety +1

      the _thumbstick variable is defined as: private InputAction _thumbstick;

    • @MEJHarrison
      @MEJHarrison Před 3 lety +1

      The _thumbstick variable is set here:
      _thumbstick = actionAsset.FindActionMap("XRI LeftHand").FindAction("Move");
      _thumbstick.Enable();

    • @MEJHarrison
      @MEJHarrison Před 3 lety +1

      @@JustinPBarnett One last thing occurred to me. I recently followed a different tutorial. Setup a sphere. I could grab it with the left or the right controller. Worked perfectly. I could hold it with my left controller and grab it with my right controller. But, I couldn't hold it with the right and grab it with the left. I watched the video 2-3 times, spent hours trying to figure it out and finally gave up.
      Now this issue. Might there be something else going on here? Could it be at this point in time it's just a pre-release bug with XR Interaction Toolkit? That's two unexplainable (to me) bugs with the left controller now.

  • @veaarthur3655
    @veaarthur3655 Před 2 lety +1

    Why did you leave Teleport Mode Cancel set to "gripPressed"?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety +2

      I'm going to do an update video on teleporting soon. Not super happy with the solution in this video and I feel like there's a better way to do it.

  • @stephenmackenzie9016
    @stephenmackenzie9016 Před 2 lety +1

    Any reason I can’t see the channels in Discord, only welcome, landing page and chat with Justin?

  • @Martsycreatives0901
    @Martsycreatives0901 Před 2 lety

    HELP Please. Script is telling me that it does not recognize - QueueTeleportRequest any idea how to fix it?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      If you're still having issues join the Discord and we can help you troubleshoot in #dev-help!

  • @ctedin1
    @ctedin1 Před 2 lety

    I inadvertently updated the XR Interaction Toolkit to the latest version (2.0.1). Typical newbie mistake. Ignored the warning that it was going to break the project. I could have used Collab to go back to the original version, but thought it might be interesting to fix the breaks that happened. The XRI Default Input Actions are very different. It broke the navigation on the left hand totally, although the right turn was still working nicely. Still testing a few more changes. I'll try to post them here and on the Discord. Has anyone tried this 2.0.1 version yet?

    • @EchteTuber
      @EchteTuber Před 2 lety +3

      I ran into the same issue. The ActionMap has changed with the update. Use these instead in the c# script:
      var activate = actionAsset.FindActionMap("XRI LeftHand Locomotion").FindAction("Teleport Mode Activate");
      var cancel = actionAsset.FindActionMap("XRI LeftHand Locomotion").FindAction("Teleport Mode Cancel");
      _thumbstick = actionAsset.FindActionMap("XRI LeftHand Locomotion").FindAction("Move");

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      If you're still having issues join the Discord and we can help you troubleshoot in #dev-help!

    • @XxXSkidXxX
      @XxXSkidXxX Před 2 lety

      @@EchteTuber This worked! You are a genius

  • @MING1130
    @MING1130 Před rokem

    我不知道你是否已经解决关于传送方向的问题,在新的xr版本中可以参考TeleportationArea组件的MatchDirectionalInput属性,这应该可以解决你的问题!

  • @joeysmith3465
    @joeysmith3465 Před 2 lety

    how do you setup project using xr interaction toolkit 2.0

  • @WolfServant
    @WolfServant Před 2 lety +1

    Anyone figure out the rotation?
    Also anyone else having the bug where you don't stop teleporting?

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety +2

      Yea there's a few bugs with this one, I'm trying to do an update video about teleporting pretty soon

    • @GiantBean
      @GiantBean Před 2 lety

      @@JustinPBarnett It would be great if you could add to the update how to change the length of the teleport arc based on the amount the thumb stick is pressed Although it would likely then need to activate with trigger rather than release.

  • @wscreamer
    @wscreamer Před 2 lety +1

    Hi Justin, I've solved the issue you have with the teleportation rotation in the video. But I'm not fully sure how to send you an email or message. Please let me know how to followup or I can explain in the comments.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Just shoot me an email or a message in the Discord!

  • @jack8750
    @jack8750 Před 3 lety +1

    In regards to directional teleporting, you might find an answer by seeing how Oculus implemented it in their Unity integration. This tutorial implements what you're describing: czcams.com/video/r1kF0PhwQ8E/video.html

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      Ooo thanks! Definitely going to look into this

    • @jack8750
      @jack8750 Před 3 lety +2

      I should mention that while mathematically the magnitude of the thumbstick pressing against the socket is equal to 1, in practice the number might be smaller (0.99 for example). The same goes for the center being point (0,0). You may want to use inequalities in the if statements to allow for a deadzone and a tolerance for the thumbstick.

    • @ctedin1
      @ctedin1 Před 2 lety

      That video uses the older OVR system. And, it's from 2019. I'm not sure it will be supported in the future.

  • @andriy_z
    @andriy_z Před 3 lety +3

    This teleportation method has nice behaviour in the editor, but in the android build, teleportation happens immediately when I press the joystick

    • @silwer222
      @silwer222 Před 3 lety +1

      same for me, it is almost instant in Quest 2

    • @andriy_z
      @andriy_z Před 3 lety +1

      @@silwer222 I done it in another way, I can share my solution if you need it

    • @silwer222
      @silwer222 Před 3 lety +1

      @@andriy_z It would be great :D

    • @HaniSharif
      @HaniSharif Před 3 lety +1

      Андрій Зімбіцький please share it

    • @danielgarciagonzalez2391
      @danielgarciagonzalez2391 Před 2 lety +1

      @@andriy_z I would like to know how you fixed it as well, please.

  • @ScratchedWinter
    @ScratchedWinter Před 3 lety +1

    @12:01 No idea what you did here ?

    • @Breyyne
      @Breyyne Před 2 lety +1

      I believe he is using Rider for coding which has shortcuts for such things as adding declarations for Variables that you add in later.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Yea I use JetBrains Rider, so I just have some hotkeys that I forget to mention sometimes

  • @westparezal
    @westparezal Před 2 lety +1

    2018-we teleported with basic animation, beautiful spline and round point model for it... 2021... wtf man?))

  • @olivername
    @olivername Před rokem +1

    That’s not new one there a new one with 5 on there now

    • @JustinPBarnett
      @JustinPBarnett  Před rokem

      Oh I highly recommend the new version now instead of this video. This one is outdated

    • @olivername
      @olivername Před rokem

      @@JustinPBarnett I still can,t get the teleport to work with controller on new input system I tried changing the code when I turn off teleport controller it works but I want to turn off by button

  • @katrinaburch4752
    @katrinaburch4752 Před 3 lety +4

    Not for beginners. This tutorial goes way too fast and is not very clear.

    • @JustinPBarnett
      @JustinPBarnett  Před 3 lety +2

      Did you watch this video first?? czcams.com/video/1VC3ZOxn2Lo/video.html

  • @Kiddrelax
    @Kiddrelax Před 2 lety

    Amazing video, I had the same problem as some people that the trigger wasnt working correctly, changed to:
    if (_thumbstick.ReadValue() != Vector2.zero)
    return;
    And it worked just fine. Another problem was the teleport was going too far away but I figured that the teleportation was being activated more than once so after I do the TeleportRequest I just added this two lines:
    provider.QueueTeleportRequest(request);
    rayInteractor.enabled = false;
    _isActive = false;
    Hope this helps someone :)