UNITY XR | ACTION BASED TELEPORTING!

Поділитися
Вставка
  • Опубліковано 27 жов 2024

КОМЕНТАРІ • 88

  • @UnityVR
    @UnityVR  3 роки тому +8

    Hi guys, hope everyone is safe & well! hope you get on okay with the video.

    • @shiaosung8401
      @shiaosung8401 3 роки тому +1

      I have been struggling with debugging with old tutorials, and yours have guided me to success within 30 minutes. You deserve more followers! Awesome tutorial!

  • @Cappsy
    @Cappsy 3 роки тому +16

    This is the first ActionBased teleport tutorial I've found that properly addresses how to set this up in the way you'd expect, and brilliantly explained too. Hope a lot more people find this and your channel, mate.

    • @UnityVR
      @UnityVR  3 роки тому

      Thanks Jonathan!

  • @ky05h1r0
    @ky05h1r0 2 роки тому +3

    Hands down, THE best XR Action-Based Interaction tutorial on UA-cam. I watched soooo many other tutorials, and still could not wrap my head around this system. The logic behind your method was immediately apparent to me, which is the most important thing a tutorial should do. Rather than just blindly following along, I can now use this same setup to call actions for a wide variety of control schemes. THANK YOU! Instant sub.

  • @livjonsson742
    @livjonsson742 2 роки тому +2

    Thanks for a really good UA-camChannel with good tutorials!
    Just a tip for all of you out there - You can use corutine with waitForSeconds with floatvalue if you want to shorten the time for the ray to disable after teleporting. I shortened it down to 0.1f instead of 1f. I am new at this so it might be somtehing better out there but here you go .:-)

  • @NightSpyderTech
    @NightSpyderTech 3 роки тому +2

    First full action based locomotion tutorial and the only one that got me teleporting properly without additional help. Awesome job! There is a new king of XRIT!

  • @enity94
    @enity94 3 роки тому +2

    Perfect! I've been struggling so long because other tutorials use Device-based setting and finally I found this awesome channel! You are a life-saver! Can't even express how grateful I am :D

  • @Gamovore
    @Gamovore 2 роки тому +1

    Hi! So just to be sure I understood correctly, the teleportation script provided by Unity forces you to use the 'Select' input action to teleport so that's why we need to specify another input action for 'Select Action' in the XR Controller component? We kinda override this input action with another? Is that right? If so they should really rework their teleportation script and let us chose the input action we wanna use haha. Thanks a lot for the video!

    • @zombizombi
      @zombizombi Рік тому +1

      That's my understanding too. I think what they should have done is put Input References on the ray interactor. The method in the video works but it feels like a cheap hack.

  • @hernandonj
    @hernandonj 2 роки тому +1

    Great video. Thank you!

  •  3 роки тому +1

    Thanks a million!
    Third method i tried today. This is how it should be done.

  • @learnwithsam200
    @learnwithsam200 3 роки тому +1

    Your tutorial is soo good and clear!! Thanks a lot mate!!

  • @marcelochs3028
    @marcelochs3028 2 роки тому +1

    I cant grab anything with putting the XR Direct Interactor script to my hands...
    My hands have a Sphere Collider which are trigger - all grabable objects have a rigidbody, collider and XR Grab Interactable
    Please help :c

  • @chunkyquail
    @chunkyquail 2 роки тому

    Beautiful. Exactly what I wanted for my game. Thanks.

  • @me_in_vr8478
    @me_in_vr8478 3 роки тому +1

    Just getting started with Unity and VR development. These videos are an amazing starting point. I seem to have an issue of my reticle showing even when not teleporting .

    • @UnityVR
      @UnityVR  3 роки тому

      Hi! thanks for the comment, check that the ray is being deactivated in the events of our script when the thumbstick is released, and not left active. I will have a play around and see what else it could possibly be.. Has anybody else had this issue?

    • @me_in_vr8478
      @me_in_vr8478 3 роки тому +1

      @@UnityVR (Edit: Solved) The problem was that I was assigning the custom reticle to the Teleport Ray Interactor Line Visual (seen somewhere in a previous video), instead of putting the custom reticle into my Teleportation Area component of my plane (as you add it to your Teleportation Anchor at 22:59 in your video).
      I tried to capture everything in this video, perhaps you'll see something I don't. ua-cam.com/video/u-Urdl9pxXI/v-deo.html

    • @UnityVR
      @UnityVR  3 роки тому

      Glad you got it sorted!

  • @rapideye101
    @rapideye101 3 роки тому +1

    Hey, you put the two Game Objects in your TeleportController, but never use them. Is this just a setup for later things? And another things i've noticed. You never enable the Input Action Asset, or do you do this just somewhere else? I've tried to reference directly the InputAction, but it does not trigger any Invokes unless i enable the Input Action Asset first somewhere.

  • @WGalex
    @WGalex 2 роки тому +1

    Muchas gracias , me ha venido genial el video!!!

  • @rudywebb9998
    @rudywebb9998 2 роки тому +1

    For some reason, my Reticle doesn't go away when teleporting short distances, any idea why this is happening?

  • @criticalthinking5500
    @criticalthinking5500 2 роки тому

    This works great!

  • @64jcl
    @64jcl 2 роки тому +2

    Ok cool, with this nice tutorial I have finally tp working on the thumb stick and picking up with the grab button. Now the only issue I seem to have is that the teleport reticle isnt removed from the spot where I teleport, very odd bug. I wonder if its a race condition where the teleportcontroller is disabled before its been able to remove the reticle. I see you add your reticle as a custom one on the actual teleport area but there is also another one on the "XR Interactor Line Visual" which would then be showing on any area you can teleport to (I use the areas instead of the achors as you do in this video). I did notice that if you use a slow timeout (0,1ms) in the script it takes some time for the disabling to happen and you are actually seeing the teleport beam in the air a bit there and the only reason the reticle disappeared then was that it is in an invalid spot when it was disabled (as you are now pointing beyond the anchor). So I believe one need to actually hide the reticle object as well manually then when the component is disabled like in these scripts.
    EDIT: Ok so that worked! In case anyone else has issues with the reticle sticking, here is how I did it: I have the reticle object in my scene but I deactivate it. I then drag the reticle object from the scene (not prefab) to the "XR Interactor Line Visual"'s reticle property, and not on each tp area/anchor. This will move this object about as the reticle when the tp beam is visible. However you also need to disable this reticle manually then when the teleport is cancelled, either in the script or the events like Daniel has configured in this video. I am sure there is some other way too but there seems to be some code in the Line Visual that is not called in order to hide this when we intervene with the tp cancel like we do.
    TIP: Another tip is that you can also add a tag to any tp area and in your script run through all tags and enable/disable the renderer for these when you activate/cancel the tp. That way you can e.g. have all the tp areas transparent and only showing when you press the thumbstick forward to tp. Here is a code snippet to show this method which I call with true/false:
    private void setTeleportAreas(bool val) {
    var tpareas = GameObject.FindGameObjectsWithTag("TeleportArea");
    foreach (GameObject area in tpareas) {
    area.GetComponent().enabled = val;
    }
    }

    • @UnityVR
      @UnityVR  2 роки тому +1

      Hi! thanks for the comments! I think a bit might have changed since the recording of this video, the XR interaction toolkit is still in preview. This might cause a few discrepancies. Glad you got it sorted and thanks for posting your tips :)

  • @EvgenyMironenko
    @EvgenyMironenko 2 роки тому

    Great tutorial!!! Thanks 👍🏽👍🏽👍🏽

  • @fabiano8888
    @fabiano8888 3 роки тому +1

    Hey Daniel! The information you share in your channel are the most updated and the ones that are helping the me most, but I am still confused. I'm new to VR development and I am getting so lost with all that XR plugins and tools variations. I wish you would have the time to put together a video explaining the main options available, pros and cons, which tools to pick over another and why, which tools can be used together, which ones we should not waste our time learning due deprecation or other reasons, which preview packages are going to become the new standard and more future proof etc. Sorry making my comment too long, but I've been putting so much time and money on courses that are no longer working. That's so frustrating. I love your content and am willing to enroll in any future courses you might make available, if they don't get me stuck like some from other instructors did. Thank you for all you do!

    • @betterlifeexe4378
      @betterlifeexe4378 3 роки тому

      Here's my 2 cents. You should look at the xr interaction toolkit, officially supported by unity. They have decent documentation, and you can watch tutorials from more than one youtube channel, as well as use other people's demo files. There's at least one good one on gethub. But at the end of the day it's going to take a lot of finagling and understanding, the tools are all kinda new still! Guess unity has got a lot on it's plate! I would use other vr specific tools only if they can be employed in your game with minimal modification. I have found that having to maintain a chunk of someone else's code is something to avoid where possible. I ended up extending my controllers functionality with combination button event listeners and the like, and now I actually understand what's happening when the code inevitably misbehaves. (My animated hands are very responsive)

    • @UnityVR
      @UnityVR  3 роки тому +1

      Hi Fabiano. Thanks for your comment. The future will certainly be OpenXR development. This is currently in preview. The holy grail for developers is to ideally develop once, deploy everywhere. OpenXR is currently available in unity 2020.2 but does not yet work with oculus. The second it does I will be using it for all VR development. In conjunction to this I think the XR interaction framework is going to be the way to develop in unity for VR, this combined with the action based input system means there is a lot to learn, and a huge investment of our time so they better not change their mind or I'm going to use Unreal :)

    • @fabiano8888
      @fabiano8888 3 роки тому

      @@UnityVR Hi Daniel. Thanks for your insights! I'll will stick with what you said and keep learning from you since I can see you're already taking your content to that direction. Thank you so much!

  • @64jcl
    @64jcl 2 роки тому

    Nice explanation of how to achieve this. I had a hunch I'd have to use two different ones and switch between them for this to work. However seeing you already have a reference to both BaseController and TeleportController you could have instead written the simple code to enable/disable the bits in those instead of the clunky event thing in the UI as both of those also needs to be configured to the same two objects? Although I guess it enables you to configure other things happening as well without editing code.

  • @TreZ
    @TreZ 2 роки тому

    This is wonderful! Thank you for this excellent tutorial!
    I've got what I expect is a minor problem, and wonder if someone might help:
    [SOLVED] - see below
    When I press Thumbstick up, it shows the teleport arc, but it teleports me instantly instead of waiting for me to release the thumbstick.
    In my Action Map, I have the following settings:
    Teleport Select:
    Primary2DAxis - Directions:Everything
    Teleport Mode Activate:
    Primary2DAxis - Directions:North
    Teleport Mode Cancel:
    gripPressed
    *EDIT*
    I figured it out about 5 minutes after posting:
    On the Teleportation Area, I needed to change 'Teleport Trigger' from 'On Select Entered' to 'On Select Exited'
    Thanks again for this excellent video!

  • @MaraldBes
    @MaraldBes 3 роки тому

    Thanks! Really helpful these tutorials that actually use the latest action-based system from Unity.
    I did run into the problem of having two hands render simultaneously. As both the base and teleportation controller render hands. What would be a solution? And also, my hands are just fine with the rotation offset, but the teleport line renderer still shoots upwards instead of forward. I watched your tutorial multiple times, and can't figure out where it goes wrong.
    I guess we can delete teleportation gameobject and basecontroller gameobject references from the script as they are not used at all.
    I still find this OpenXR with the toolkit very limiting compared to OpenVR (steam) Unity Asset implementation, which did teleport, grab, animation, hand-poses, bow and arrow, multiple control sets and much more, really nice out of the box.
    Using Unity with Open XR is probably the future, so I can only hope that Valve implements everything their OpenVR Unity feature-wise did, in OpenXR as well.

  • @Bassquake76
    @Bassquake76 Рік тому

    How do you still interact with objects? When I point the teleport line to an interactable object, it automatically pulls it to the hand then just bounces off.

  • @XavierDetcheverry001
    @XavierDetcheverry001 3 роки тому +1

    You're great !!!

  • @linkmotion5776
    @linkmotion5776 2 роки тому +1

    Good!!

  • @김윤준-e7f
    @김윤준-e7f 3 роки тому +1

    what a video!! any ideas for scene fader during teleporting??

    • @UnityVR
      @UnityVR  3 роки тому

      Hi, I go into that a bit in this video > ua-cam.com/video/Mcg4kjSKG3M/v-deo.html

  • @stephenmackenzie9016
    @stephenmackenzie9016 2 роки тому

    So the cancel action is actually the trigger for teleportation to actually start?

  • @Riprog
    @Riprog 3 роки тому

    Great tutorial Daniel!
    I noticed that when teleporting you end up on the center of the anchor, is there an easy way to fix so you actually end up where your teleport reticle is when activating the teleportation? Also I wonder how complex it would be to make an arrow as a reticle which show which way you will be facing when the teleportation is complete?
    Big thanks for these series, helped me a lot!

    • @64jcl
      @64jcl 2 роки тому +1

      Don't use the Teleportation Anchor but add a Teleportation Area to any object you make. You can draw e.g. a plane with any shape you want and use the whole area as a valid teleportation location.

  • @stephenmackenzie9016
    @stephenmackenzie9016 3 роки тому

    So my line renderer is just pink (I am using URP)....also my reticle is constantly flashing. And when I release my teleport thumbstick, I don't always move - but do sometimes (!)

  • @NightSpyderTech
    @NightSpyderTech 3 роки тому +2

    Any chance of getting this project added to patreon? That's all I'm waiting on to pledge.

    • @UnityVR
      @UnityVR  3 роки тому

      Hi! I thought it was on there...don't know what happened! I will upload it over the weekend :)

  • @songqiao
    @songqiao 2 роки тому +1

    👍

  • @betterlifeexe4378
    @betterlifeexe4378 3 роки тому +1

    I would be interested in what people are working on in vr these days, I myself am working on a educational game with elements of rhythm , combat, stealth, and strategy. Hopefully I make it more fun and engaging than other attempts at 'gamifying' education.

    • @UnityVR
      @UnityVR  3 роки тому +1

      Wow that sounds great! how are you finding development? In regards to me - as well as the YT tutorials I'm working on a quest game (very early days) which will be puzzle based, a bit like 'The Room VR'

    • @betterlifeexe4378
      @betterlifeexe4378 3 роки тому

      @@UnityVR I find development slow and painful, but I expected that. I'm still kind of new to c#, I've spent my time programming jumping from python to Javascript and then to c#. Spent a lot of time with Aframe and 3.js but it just didn't have enough graphical capabilities for what I wanted. Now that I'm actually using unity, my project has gotten feature-bogged.
      I am currently trying to get the main state controller to accept my level generator and use it to reconfigure the arena. Getting my level generator to combine and transform my learning data and settings profiles into usable levels was a huge time suck. I do not look forward to working on the state manager for my enemy AI.
      Controls are done, for now. modelling is just placeholders, although I have already chosen my textures and shaders more or less... the animations I still have to do should be easy after setting up hand animations. The only aesthetic thing I'm scared of is the player character. I'm thinking head and hands only...
      how are you approaching avatars? Do you have any experience with state machines? Sorry if I'm going on and on, always talking about my code these days. Wish I didn't have to program this whole thing single handedly.

  • @taracollingwoode-williams4926
    @taracollingwoode-williams4926 3 роки тому +1

    Great tutorial - for some reason my teleport only works once, then the controllers stop tracking and only snap turn works.

    • @UnityVR
      @UnityVR  3 роки тому

      Hi sounds like a weird one! I would check to see what happens in the inspector to make sure the correct components are being toggled off and on.

  • @jaydencdq
    @jaydencdq 3 роки тому +1

    Hey! I'm having an issue where the line and the reticule only show up for like 0.1 seconds when I activate teleportation mode, when it's supposed to just stay until you let go. If you could help me that'd be great. Thank you!

    • @UnityVR
      @UnityVR  3 роки тому

      Hi, its a little tricky to determine as there are a couple of things it might be. can you post your teleportation controller code as a reply? then we can rule that out :)

    • @jaydencdq
      @jaydencdq 3 роки тому

      @@UnityVR Sure!
      using UnityEngine;
      using UnityEngine.InputSystem;
      using UnityEngine.Events;
      public class TeleportController : MonoBehaviour
      {
      public GameObject baseControllerGameObject;
      public GameObject teleportationGameObject;
      public InputActionReference teleportActivationReference;
      [Space]
      public UnityEvent onTeleportActivate;
      public UnityEvent onTeleportCancel;
      private void Start()
      {
      teleportActivationReference.action.performed += TeleportModeActivate;
      teleportActivationReference.action.performed += TeleportModeCancel;
      }
      private void TeleportModeCancel(InputAction.CallbackContext obj) => Invoke("DeactivateTeleporter", .1f);
      void DeactivateTeleporter() => onTeleportCancel.Invoke();
      private void TeleportModeActivate(InputAction.CallbackContext obj) => onTeleportActivate.Invoke();
      }

    • @UnityVR
      @UnityVR  3 роки тому

      oh also just check in the events assignment (where you turn the controllers off/on) that your not turning the XR ray interactor off when it should be on. I think from memory I had an onActivate event or something... make sure you have the XR ray interactor on :)

    • @jaydencdq
      @jaydencdq 3 роки тому

      @@UnityVR hmmm yeah it looks like it's all right, I think I might just completely restart and try to follow as close as I can, what is the best order to watch the videos?

    • @UnityVR
      @UnityVR  3 роки тому +1

      ​@@jaydencdq Hi, I see what's going on :) under start you have two 'teleportActivationReference.action.performed' The bottom one should be teleportActivationReference.action.canceled'

  • @lionelmaquet
    @lionelmaquet Рік тому

    I'm really struggling to understand what actually causes the teleportation to happen. When you move the thumbstick up, it enables the ray, when you let go of the thumbstick, it disables the ray.
    In the teleportation controller, we set the select action to be the teleportation select action, which is binded to the thumbstick moving. I therefore don't understand why, when the ray is enabled, we don't teleport as soon as we make a slight move with the thumbstick. Why does it only happen when we let go of it ?
    I suppose it has something to do with the invokation of the cancel method waiting for a bit before being called, but I can't seem to really understand what's happening.
    If anyone has the answer and a logic explanation, i'd be very greatful.
    Other than that, brilliant video, thank you for sharing !
    ---------------------- EDIT
    I just now remembered that, by default, when using the grab trigger to teleport, it only does so when the button is actually released.
    Even though i don't know where this is controlled and where this behavior could be modified, it therefore explains everything. The logic is therefore as follows :
    1) You press up to activate the ray
    2) The action for teleportation is set to the "teleport selection action" because it needs to be triggered no matter the position of the thumbstick when you release it
    3) If there was no delay before invoking the cancel method, the ray could be deactivated before the teleportation action is triggered. Therefore in the script, the slight delay gives just enough time for the teleportation to happen before disabling the teleportation controller.
    It's at least my understanding, and even though it might be obvious for some, It might help some others, so, I might as well lay it here :)
    ---------------------- EDIT 2
    The only thing that is now leaving me wondering, is the variables baseControllerGameObject and teleportationGameObject in the script. I don't understand how they are useful. We don't reference them anywhere and they are not used it the script, am i missing something ?

  • @SMG-1138
    @SMG-1138 2 роки тому

    I don't know if this is active enough for a reply or not. No matter what I do when i move the reticule off of the teleport anchor it immediately teleports. I 100% have the keep selected target valid unticked. I cannot move between anchors, it just teleports. I have quite literally watched this video 20 times. i get to the end and go back tot he beginning looking for whatever I've missed and just can't find it. Any ideas?

    • @UnityVR
      @UnityVR  2 роки тому

      Hi Simon, XR interaction toolkit has gone through so many updates over the last six months its crazy... here is a video I made from a more recent playlist: ua-cam.com/video/mh1lYjSS9es/v-deo.html - see if that helps

  • @olivername
    @olivername Рік тому

    I got issue with a ray line on teleport were is moving away from hands not sure why @Daniel stringer

  • @billybobthe9thjr786
    @billybobthe9thjr786 Рік тому

    anyone know how to get this to work along with grabbing
    the interactor ray is still trying to grab stuff
    and yes i watched the layer vid.

  • @charlottedegooijer4536
    @charlottedegooijer4536 3 роки тому +1

    Thank you for these great videos! I tried following along, but Unity throws the error:
    InvalidOperationException: Cannot read value of type 'Vector3' from control '/OculusTouchControllerRight/thumbstick' bound to action 'XRI RightHand/Teleport Mode
    I have tried messing around with the Input Action bindings and types (like in the Hands tutorial) but that didn't help.. Any thoughts? Thanks in advance! :D

    • @charlottedegooijer4536
      @charlottedegooijer4536 3 роки тому +1

      Nevermind, got it! Set wrong references on the XR Controller ^^'

    • @UnityVR
      @UnityVR  3 роки тому +1

      Glad you got it working!

  • @YT-ql7me
    @YT-ql7me 3 роки тому +1

    Thanks for the great video!! I set up the teleportation on my side and it sometimes work sucessfully and teleport to desired region and sometimes its not responding. Could you tell whats the problem may be?

    • @UnityVR
      @UnityVR  3 роки тому

      Thanks, sorry to hear you are having trouble. Firstly I would check the 'Keep selected target valid' is unchecked. if it is then just check the teleport controller script to make sure that the correct interactors are being turned off and on when required. Then if its not that check to see that your event listeners are setup correctly.

    • @seankennedy4379
      @seankennedy4379 3 роки тому

      @@UnityVR Hi there! I'm having a similar problem where the first teleport works perfectly but every subsequent one just nudges me a little bit in the direction I want to go rather than teleporting me there. I've made sure the Keep Selected Target Valid script is unchecked, and if the correct interactors to be enabled and disabled go in the order of
      ActionBasedController.enableInputActions off
      XRDirectInterctor.enabled on (based on the next tutorial in the series)
      ActionBasedController.enableInputActions on
      XRRayInteractor.enabled on
      ActionBasedController.enableInputActions on
      XRDirectINteractor.enabled on
      ActionBasedController.enableInputActions off
      XRRayInteractor.enabled off
      Then I think that is correct too. Could you clarify what you mean by event listeners being set up correctly? I'm very new to Unity so I'm not quite sure how to check that. That probably is the root of my problem.

    • @seankennedy4379
      @seankennedy4379 3 роки тому

      I figured it out! I was using Teleport Anchors when I wanted Teleport Areas

  • @DigitalAdamTech
    @DigitalAdamTech 3 роки тому

    Hi, do you know what the difference is between the Input Action Manager and the Player Input script?

    • @UnityVR
      @UnityVR  3 роки тому +1

      Hi Adam. The input action manager is the interface between your devices and unity. You can set up you own input action to detect user input from a range of devices. I think the player input script is the second part that links the input action manager to your scripts. I think I tried using it for VR once and it caused major performance issues. Worth looking into though.

  • @zombizombi
    @zombizombi Рік тому

    Why don't Unity just put input references directly on the ray interactor.. if you look at the default action maps there's a Teleport/Select action, ie, an action specifically for teleporting, yet it's ignored in favour of the regular Select action.

  • @tedhayes2441
    @tedhayes2441 3 роки тому

    I ended up having some issues with the teleporter. It's flashing blue to green like it's constantly going between recognized and unrecognized for the floor. Is there a project on Patreon with the action-based teleporter in it?

    • @UnityVR
      @UnityVR  3 роки тому

      Hi Ted I will have to check... sounds annoying. sorry its not working. is it swopping between a teleport ray and ray interactor or valid to not valid?

    • @tedhayes2441
      @tedhayes2441 3 роки тому

      ​@@UnityVR​between valid and not valid on teleport ray

    • @olsen99q
      @olsen99q 3 роки тому

      i've got the same problem, did you ever solve it?

    • @tedhayes2441
      @tedhayes2441 3 роки тому

      @@olsen99q I ended up grabbing the patreon project and having it up as a reference while I recreated things in my project in a fresh scene. I also pulled over hands, animations and scripts from the patreon project.

    • @blackwhalestudio
      @blackwhalestudio 2 роки тому +1

      For everybody who has this issue, make sure your reticle has no collider attached!

  • @ahmetcankaya7666
    @ahmetcankaya7666 2 роки тому

    Why i can teleport just middle of the teleport area?

    • @Digital.Justin
      @Digital.Justin 2 роки тому

      Most likely it's because you're just using the teleportation anchors, and not the teleportation area.

  • @kederop7012
    @kederop7012 3 роки тому

    How dont you use the quest 2 ?

    • @UnityVR
      @UnityVR  3 роки тому

      Hi, in the videos during filming its quicker to test on my rift as I don't have a link cable, and don't want to do a build.

    • @kederop7012
      @kederop7012 3 роки тому

      Ooh okay