Unity VR Game Basics - PART 6 - Teleportation

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 64

  • @zillieness
    @zillieness Před rokem +10

    These tutorials have been SO helpful!! For anyone who can't teleport, or you teleport instantly without releasing the thumbstick, I have two fixes:
    1) If you try to teleport but nothing happens: It seems like the XRI Default Input Actions "Action Maps" names have updated from "XRI LeftHand" to "XRI LeftHand Locomotion" in newer versions of Unity, and so the code needs to match. Around lines 50 - 60, there are three lines that use FindActionMap() and need to be updated to have the " Locomotion" added. Example: inputAction.FindActionMap("XRI" + targetController.ToString() + " Locomotion"). Then you should be able to teleport!
    2) If you teleport instantly upon pressing the thumb stick down: Go to void Update() and make the third if statement read: if (_thumbstickInputAction.IsPressed()). And then you should be able to hold the thumb stick down, release, and then teleport!

    • @vojtastir2382
      @vojtastir2382 Před rokem +2

      Thank you so much, I was desperate already.

    • @PrzemekPol
      @PrzemekPol Před rokem +2

      Thank you very much.

    • @olivername
      @olivername Před rokem

      I got the new input system and try this but nothing is working with teleport and put the code on both rays

    • @alexmustin
      @alexmustin Před rokem

      @@olivername Same here -- when I push the stick forward, the rays show up, but in red, as if it's not recognizing the position of (or not colliding with) my locomotion area

    • @alexmustin
      @alexmustin Před rokem

      @FistFullofShrimp -
      UPDATE - Jul 31 2023
      Through debug logging, I found that the script does not get past the point:
      if (!_teleportIsActive) { ... }
      Do you have any ideas where we could start looking to fix this? Thx in advance!

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

    Always love your videos. You deserve a big recognition my man

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

      I really appreciate you saying so. Hope to get more great content out soon! Cheers!!!

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

    Yes. Great stuff. Thanks and subbed.

  • @Nycrix
    @Nycrix Před 2 lety +5

    Tried this teleportation method and it's working great in the editor, but in the android build, teleportation happens immediately when I press the joystick. Any Idea how to fix this?

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

    I made sure I followed all the steps and whenever I first try to test it, it doesn’t teleport but idk what’s going on

  • @kysonic
    @kysonic Před rokem

    Great! Thank you so much!

  • @pulkit.guglani
    @pulkit.guglani Před 2 lety +4

    I'm having an issue, the ray is visible only for 0.5sec and teleport me instantly to the location, it is not waiting for me to release the joystick. Same is happening if no teleportable plane is found, ray just disappear after 0.5 sec.

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

      I'd check out the Teleportation Controller script on you Left and Right Teleporting Rays. Make sure the Target Controller is set to Left/Right correctly.

    • @pulkit.guglani
      @pulkit.guglani Před 2 lety +1

      @@FistFullofShrimp Thanks for replying. After rechecking, I got to know that I added the collider to reticle, so when reticle appeared, the ray thought that I am pointing to non teleportable layer, hence the cycle repeats. So I removed the collider and problem is solved.

  • @ANUBIS_game_dev
    @ANUBIS_game_dev Před 2 lety

    you are the best🥰. I can't wait ! . Please make next part 😍

  • @Get2KnowOli
    @Get2KnowOli Před rokem +1

    Great Video!
    Somehow I get automatically teleported after a small delay?
    Can't seem to find the issue :(

  • @TheARTofMining
    @TheARTofMining Před 5 měsíci

    Great tutorials mate! - I am struggling for a reliable way to teleport to an ANCHOR via a script call instead of by teleportion interactor. The idea is to be able to call series of teleports to anchors over time. Imagine a timeline based tour system that walks you through a scene as it narrates. My simple theory is to be able to request an ANCHOR teleport but I have no idea how to implement this. The Telport Anchor is perfect as it orientates the player correctly. Do you have any suggestions? Thanks very much!

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

    this is a great video as always! i have one question though, how do you limit the input action to just the forward direction on the thumbstick? i seem to only be able to do the y-axis as a whole so forward and back both initiate the teleport. idk what im missing and unity's new input system is still pretty confusing for me

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

      The new input system screws me up as well. I definitely see the benefits too it, but it does take some getting used to.
      As for your question, you should be able to find the limiting factor if you open up the XRI Default Input Actions. Select XRI LeftHand, find and expand the Teleport Mode Activate action, and select Primary2DAxis. On the right hand side you'll see something that says Directions = North. This is pretty much telling the action to only activate when the directional pad is pushed north(up). You may also want to read up on Sweep Behavior depending on how you want your teleport to cancel. The XR Interaction Toolkit sets it to Locked by default, but you might prefer a different mode. Here's a link if you want to read up on that.
      docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@0.10/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Interactions.SectorInteraction.SweepBehavior.html
      Hope this helps! Cheers!

  • @Joysticful
    @Joysticful Před 2 lety

    great staff thx

  • @wmka
    @wmka Před rokem

    I'm thinking of making a teleport into the diorama scale down and out of diorama scale up.

  • @PrzemekPol
    @PrzemekPol Před rokem +1

    09:43 I would indeed be very interested to know how to implement both interaction and teleporation. What is necessary for this?

    • @FistFullofShrimp
      @FistFullofShrimp  Před rokem +1

      The approach I would take would involve adding two Events in the Teleportation Controller Script. One Event would be for when the Teleporting system is active and another for when it is inactive. Then I'd have the Script for the Ray Interactors listen for those events and turn off during Teleportation being active and on when Teleportation is inactive. Hope this helps!

    • @PrzemekPol
      @PrzemekPol Před rokem

      @@FistFullofShrimp It does - thank you. I implemented something similar by activating/ deactivating Teleporting depending on the button input. It does work but not 100% reliable,, which events would you choose?

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

    hey there, your videos are really helpful. Everything has been working great so far.
    However, I do have a problem now. I followed evertying till 16:40 but I always get the following error: "NullReferenceException: Object reference not set to an instance of an object" at line 52 and 68. I'm kinda new to C# and Unity so I'm really struggling there.
    Anyway, keep up the good work! I'm always so excited when a new video comes out.

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

      Thanks for the kind word! Now lets see if we can figure this out.
      If it's giving you a NullReferenceException, it means we haven't set the variable. Specifically, line 52 is trying to look up the action map for "Teleport mode Activate". It does this by using the public variable on line 25 that is a InputActionAsset variable called inputActions. The most likely thing going on is that this variable isn't set and so when it tries to lookup the action map associated with it, it can't find anything and sets it to null.
      To fix this, head back to the editor and make sure the InputAction variable is set for the left and right controller. An example can be found in the video at this timestamp.
      czcams.com/video/q1HuVUdq9ps/video.html
      Hope this fixes it!

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

      @@FistFullofShrimp yup that was it. Thank you so much! :)

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

      @@nad1314 Glad I could help! Happy learnings

    • @olivername
      @olivername Před rokem

      @@FistFullofShrimp I check this but still got it

  • @donald1w12
    @donald1w12 Před 2 lety

    This is great tutorial. It would be awesome to be able to do continuous movement and teleportation at the same time. A Township Tale does this by using the primaryButton to start the teleportation and then releasing the primaryButton finishes the teleportation. I tried doing this but I don't know how to grab the primaryButton release action. Let me know if you have any ideas.

  • @marlinvr8441
    @marlinvr8441 Před 2 lety

    can you pls show how to do gorilla tag type movement i love your vides and they have really helped

  • @lukexie3449
    @lukexie3449 Před rokem

    I have a very strange situation, I have to press the grip button first, then push the tumpstick, and then release the grip to teleport. If I push the tumpstick first and press the grip, the ray of the teleport will disappear, and the teleport will be invalid.

  • @hata5966
    @hata5966 Před rokem

    Does anyone know how to teleport with orientation with XRToolKits?

  • @simongilbert4865
    @simongilbert4865 Před rokem

    can you make a ui system that allows us to change between teleportation and continuous movement and snap turn and continuous turn

  • @matiaspina2323
    @matiaspina2323 Před rokem

    Your tutorial really helped me out, but I have a little problem and I don't know how to fix it. When I use the teleportation, the player immediately moves to the new position instead of waiting until I release the thumbstick. Can anyone help me?

    • @francescocapezio359
      @francescocapezio359 Před 5 měsíci

      in the update() method, into the third if statement change _thumbstickInputAction.triggered whit _thumbstickInputAction.IsPressed()

  • @olivername
    @olivername Před rokem

    this code still does not work for me

  • @RobotçuDayı
    @RobotçuDayı Před 2 lety

    When we come to the end of the video, the teleport anchor does not work

    • @RobotçuDayı
      @RobotçuDayı Před 2 lety

      Also, when we hold the ball, our hands are hidden. This was not in previous videos. Which setting do we turn on, hands appear?

    • @AquaDragon6629
      @AquaDragon6629 Před rokem

      @@RobotçuDayı This was actually in the last video he did 😬

  • @enveleptionstudios8711

    Works great.
    Altough every frame that I try to teleport (hold the tumbstick down) I get a error that leads me to the " if (!rayInteractor.enabled) return" (At 14:36 - Line 84)
    Does anyone know why this happens and how to fix it?

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

      My first guess would be that the rayInteractor hasn't been set in the editor and so when it is checking if it's enabled, it's referencing an empty variable. Make sure to check your right and left ray teleports in the editor and see if they have their rayInteractors set. Cheers!

    • @enveleptionstudios8711
      @enveleptionstudios8711 Před 2 lety

      @@FistFullofShrimp thanks for the replay. I had already done that and it all works just fine. Just 200+ errors that seemingly do nothing though

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

    I think you left out the _thumbstickInputAction.Enable(); statement

    • @FistFullofShrimp
      @FistFullofShrimp  Před 2 lety

      You know what? You're 100% correct. Thanks for letting me know so I can update the github project. Cheers!!!

    • @olivername
      @olivername Před rokem

      where do I put that

  • @youssefboussaid2063
    @youssefboussaid2063 Před rokem

    thank you for this awsome tutorial, but i have a problem when i teleport my camera atltidude changes when i start the project the camera is in the right altitude but when i teleport it goes to the floor level.
    anyway keep up the good work

    • @elisacollins9246
      @elisacollins9246 Před rokem

      If this problem pertains to the Teleportation Anchor, try checking it's transform and the transform associated with it's Anchor child object. Also check the setting of the Match Orientation in the Teleportation Anchor script area. You might have accidently set value(s) differently than the values shown in the video, which work fine for me.

  • @AquaDragon6629
    @AquaDragon6629 Před rokem

    i had only one problem with this! The videos are incredible, and i thank you very much for your help!
    I have a plane around my teleportation zone , and when I try to teleport to it, it puts me at the origin of the plane gameObject. I'm unsure of how to rectify this, because i don't want to be able teleport there :P Any help is much appreciated :)

    • @AquaDragon6629
      @AquaDragon6629 Před rokem

      Ah.. never mind.. i forgot to put a return: on line 97.. If anyone has this issue check this haha

  • @olivername
    @olivername Před rokem

    hi Fist Full of Shrimp I have an issues where line reader is not always in my hand keeps being in middle any help would be great

  • @loBokyin1006
    @loBokyin1006 Před 2 lety

    Thanks for your videos! The instructions are very clear and inspiring for those who is not so familiar with c#! :)
    I am trying to work on the script part,
    the teleport ray is not working whenever the script is enabled. I saw another comment from Nad but my log is slightly different," NullReferenceException: Object reference not set to an instance of an object
    TeleportationController.OnDestroy () (at Assets/Scripts/TeleportationController.cs:69)"
    Do you have any idea? Thanks a lot!

    • @loBokyin1006
      @loBokyin1006 Před 2 lety

      In case someone encountered the same issue:
      The input action map may be slightly different (In my case: XRI is split into RightHand, RightHand Locomotion, and RightHand Interaction) so that the script cannot reference the action maps. To solve it, just simply drag the actions from locomotion to the right column!
      The detailed comment lines and the video really helps me solve this. I really appreciate your work and thank you soooooo much!

    • @hardman7235
      @hardman7235 Před 2 lety

      @@loBokyin1006 could you please elaborate a bit more on what you mean by dragging them to the right column? i'm stuck on this same issue

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

      @@hardman7235 When you open the "XRI Default input Actions" menu, there are Action maps on the left (tagged yellow) and Actions in the middle (tagged green). Select all the teleport-related actions and drag to the corresponding Action Maps on the left, then it should be working!

    • @olivername
      @olivername Před rokem

      @@loBokyin1006 I got the issue where teleport works in you take off the script the teleport works but I think thats my issue too won't turn off by controller because of new input system

    • @olivername
      @olivername Před rokem

      @@loBokyin1006 I did this but still not working