How to use VR Sockets (and XR Interaction Toolkit) in Unity 2021.2

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

КОМЕНТАРІ • 107

  • @JustinPBarnett
    @JustinPBarnett  2 роки тому +6

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

  • @tatepayton7368
    @tatepayton7368 2 роки тому +8

    This is just what I was waiting for! A simple way to make things like backpacks and stuff with sockets. Thank you so much for helping out the VR community!

  • @FusedVR
    @FusedVR 2 роки тому +4

    Super comprehensive. Very nicely done!

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

    Once agin, great and simple to understand tutorial. I like that you're always checking up on XR toolkit from Unity and making new tutorials about it, allows anyone new to just jump right in and get started with those tool!

  • @Ollie_sm
    @Ollie_sm 2 роки тому +5

    could you do a tutorial on how to make it possible to climb and glide and even an accurate gliding mode where you can steer up and down using your hands

    • @JustinPBarnett
      @JustinPBarnett  2 роки тому +4

      Ooo that’s a cool idea! I’ll add that to my list!

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

      @@JustinPBarnett thank you so much!

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

      @@JustinPBarnett mechanics similar to this would be great ua-cam.com/video/jEiKb2-DdDQ/v-deo.html much better than gliding in most vr games

  • @infectedgoat99
    @infectedgoat99 2 роки тому +8

    How did you figure all this out on your own? Incredible video, super helpful. ALSO for anyone struggling with getting the hammer to face the right direction when holding, make sure in the XR Grab Interactable script that you drag your empty game object "Attach Point" onto the "Attach Transform" otherwise the object wont use your attach points!

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

      Lots of testing and just playing around in Unity 😜 and thanks for the tip!

    • @V-ROCstudios
      @V-ROCstudios 2 роки тому +1

      Thanks. I kept thinking I needed to rotate a component.

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

      haha just worked this out myself and then thought "someone else must have had this problem..."

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

      Thank you soooo much omg tried to figure this out for an hour and a half before coming here

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

    great Patreon! it has everything I needed.

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

    Once again, I must proclaim that you are, in fact, the MVP. Thanks for the great tutorials!

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

    Thank god you did this tutorial. I would have problems this Sunday 😆

  • @4per8
    @4per8 Рік тому +1

    immana use this for a debug menu in the game im working on, might be cool

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

    The timing on this video couldn't have been better. Ran into the missing XR Interaction Toolkit issue yesterday when I updated to 2021.2.6f1 and today I decided to check out my go-to Unity VR resource on UA-cam...and what do you know? :)) Massive thanks for all the content, would take me forever to figure this stuff out on my own.

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

    Insanely useful tutorial. Thanks Justin!!

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

    Heads up, Toolkit is spelled wrong in your title. It says tookit. Great tutorial keep em up!!

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

    OMG, can't believe they changed it all again 😫

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

    Very nice tutorial. Thanks. My new favorite channel.
    Could you do a tutorial on Hand interaction with colliders on say a desk or wall?
    Specifically, where if you push the controller through the desk, that the hand stays on the desk until you bring the controller back to the hand position and it will track with the controller again.
    Or is this built-in to the tool kit?
    I know some VR interaction tool kits have this feature.

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

      It's not built into the toolkit, but I have made a video about physics hands! Check it out: ua-cam.com/video/RwGIyRy-Lss/v-deo.html

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

      @@JustinPBarnett cheers. I saw that after I wrote the message. Thanks

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

    Thanks for this, helped a tonne. I'm just wondering, how would you go about making items being able to stack up on each other? Our game is a survival/horror game and we want players able to put more than one of the same item into a hotbar, which is a sphere socket interactor. Our game takes heavy inspiration from "A Township Tale" if you're familiar.

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

      have you found the answer? plese let me know if you do

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

    Hey Justin! Love your content, keep it up! I have an issue with using XR Socket Interactors in multiplayer applications using Photon (PUN 2), so far I've gotten no response on the Unity forums. The problem I face is that if a player puts an object in a socket and then grabs it again, the item remains in the socket for other players (not seeing that a player has a grabable in hand). The item has a photon view component on it and also a photon rigidbody view component, I suppose you need to add some component to the socket interactor? Thanks in advance!

    • @АндрійНесвідомін
      @АндрійНесвідомін 2 роки тому +1

      I have the same problem, just yesterday I saw your post on the Unity forum :). Justin, if you can give any advice would be very grateful too!

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

      So my initial guess is that is has something to do with parenting the object. Maybe try adding a script to have it follow the socket attach point every frame instead of parenting it. Just a guess though.

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

      Hi ! I have the same issue, have you found the solution to the problem ?

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

    Hi Justin, great tutorial! would you be able to show how to do power cables with the Obi Rope addon like plug in and un plug :)

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

      That’d be cool! I haven’t used it but I’ll look into it

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

    I love your vids self taught inspiring game dev have been binge watching your vid and using them as projects but i cant figure out where im going wroong here my line visiuals arent tracking they just go up and down

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

      Thanks! Join the discord and we can help you out!

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

    hey justin really love the conent. can you make a video on unity vs unreal engine 5 for vr development !!!!!

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

      Yea! I actually dabbled around in unreal for a bit before coming over to unity. I talked about it a bit in my “What you need to start VR” video

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

    ayo hold on, letss goo, exactly what i needed. btw i need to add a simple bean to act as the character, like follow the xr rig, cuz when i put it under the xr rig it doesnt follow the camera movement, but when i move it under the camera, it breakdances on me. oh and also how the hell do i stop my character from being able to fly when holding an interactable
    ways to recreate: create basic xr rig (action based) create an interactable, hold the interactable under the player.

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

      You can checkout my VR movement video for getting the collider to follow your camera. And in order to prevent held things from interacting you should set them to an “interactable” layer and set the player to a “player” layer and then in your project settings > physics make sure in the grid that the checkbox between the layers is unchecked so they don’t interact

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

      @@JustinPBarnett thanks a lot! also does ur video include adding a visual character to the xr rig? cuz my project is a vr shooter and it needs the character to not only to have a body, but the body to have a collider. so how the hell do i set up the character model (i only need it to be a bean) to the xr rig?

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

      @@gnomge I do have another video about that! Inverse kinematics

  • @torstenknodt6866
    @torstenknodt6866 11 місяців тому

    Great video, thanks! Is there a way to check dynamically whether a socket interactable could really be dropped on a socket interactor or there is some use-case specific condition which does not allow it?

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

    Impressive! Thanks for sharing!
    I wonder if there is a workaround so that only objects that are being grabbed atm can be selected in the socket. I already tried to play around with some things in the public override bool CanSelect(XRBaseInteractable interactable) interactable.isSelected.. but nothing seems to work xD Thanks in advance if anyone has a hint^^

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

      I was actually playing around with that today and couldn’t find a solution for that either 🤔

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

      I know it has been 4 weeks now, but It was tricky and I found a (mostly satisfactory) solution so posting it here for you in case it is still relevant. What I did is I switched the layermask on the interactable when the interactable hovers over the socket (OnHoverEnter interaction event) to a layer which can not interact with the socket, on the condition that an XRDirectInteractor is not currently selecting the interactable.
      The tricky part here is that you have to switch back to the originla layermask. First my intuition was to do it on the OnHoverExit event, but since the interactable was moved to another interaction layer, the socket was not detecting events on it anymore... So instead I implemented a coroutine which resets the layer mask on the interactable if the interactable is selected, or moves away a certain distance from the socket. This mostly works well, the only hiccup is that when the (ungrabbed) interactable falls into the socket, it still stops for a second before falling through it. However, the socket will not pick up the interactable even if the interactor rests right on top of it. Here is the code for reference (the disableInteractor method is bound to the OnHoverEnter event of the socket. Note that interaction layer numbering starts from 1 not 0. Also note that when the interactable hovers above the socket it already counts as selected. ):
      // Disable the interactable if it is not grabbed when placed into the socket (e.g. it conincidentally falls/bumps in it)
      public void disableInteractor( HoverEnterEventArgs eventargs )
      {
      XRGrabInteractable interactable = (XRGrabInteractable) eventargs.interactableObject;
      if ( interactable.interactorsSelecting[0].GetType() != typeof( XRDirectInteractor ) )
      {
      //interactable.GetComponent( ).enabled = false;
      interactable.interactionLayers = 2;
      StartCoroutine( reEnableInteractor( interactable, interactable.interactorsSelecting[0] ) );
      };
      }
      // Reenable the interactor after an accidental fall/bump into the socket
      private IEnumerator reEnableInteractor( XRGrabInteractable interactable, IXRSelectInteractor interactor )
      {
      while ( Vector3.Distance( interactable.gameObject.transform.position, interactor.transform.position ) < 0.2f )
      {
      if ( interactable.isSelected && interactable.interactorsSelecting[0].GetType( ) == typeof( XRBaseInteractor ) )
      {
      interactable.interactionLayers = 1;
      break;
      }
      else
      {
      yield return new WaitForSeconds( 0.1f );
      }
      }
      interactable.interactionLayers = 1;
      }
      Hope this might help some people.

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

    Did you miss a step? Were you supposed to make the Attach Points selected in the Attach Transform selection? Until I did that, it was ignoring my Attach Points completely and the hammer was facing the wrong way, the shield was being held right in the centre

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

    Hi Justin, Im using the Oculus interaction (OVR) but i can find any snap or socket script, please help me

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

      Same problem here. Youve got the solution?

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

    who can tell me if i want use xr sockets apply in slot and become 2d image ,how should i do?

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

    Thank you for your wonderful tutorial. If using xrit to splice objects, similar to LEGO, how can they be connected one by one? Do you have any good suggestions?

  • @Jason-eo7xo
    @Jason-eo7xo 2 роки тому +1

    so awesome!

  • @wisdomkhan
    @wisdomkhan 7 місяців тому

    Any idea how to make a Lego VR game?

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

    How do we make the hammer and shield collide with each other when held? or is that not possible. I see they collide with the world and they collide with each other when not held but I can't bang them together while holding them. I don't know if I ever will want to but it might be handy to know

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

      Change the grab interactable component grab type from instantanious to velocity tracking

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

    Only renders in the Left eye. Did I accidently click something I shouldn't have?

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

      Try going to project settings > OpenXR > and swap render mode to multi-pass

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

      @@JustinPBarnett Yep! That fixed it. NOTE i have both the PC and Android OpenXR setting and first I tried it on the Android part and it made no difference so I did it on the PC setting part and it worked. So basically it's the PC Settings that matter when streaming from the PC to the headset and the Android if you Build and send the file to the headset to play it there? is that correct?

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

      @@JustinPBarnett as a side benefit I now know how to simulate a pirate player character with a patch on his right eye if I ever create a swashbuckling VR game 😁

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

    Very nice tutorial. But i don't know how to launch my project on quest 2. Do i need to do something special?
    Cheers

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

      Like build your project to the quest or just run it in play mode?

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

      @@JustinPBarnett Thanks for answering! Got help on your discord. I had to disable air link and then plug in cable and enable on quest.
      👍💪

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

      @@1998natan awesome!!

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

    How can i do this with the Oculus Integration (OVR)?

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

    Awesome thanks so much….. unity should by default setup your scene….

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

      Yea that'd be nice. There is a VR template, but it's not really that great

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

    Great tutorial! Is there any way to make it so the player has to place the interactable object into the socket? I have a socket attached to my players finger for attaching rings and I can pick up the ring with one hand and put it onto the finger of the other hand just fine, but I can also just move my hand over a ring sitting on a table and it will snap to the socket automatically. I want the player to manually drop the ring onto the finger.

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

    hey, great video. just wanted to ask if i should continue with unity 2020 or if you think i should use 2021 instead? i'm only up to importing hands in 2020 so it wouldn't waste much time to start the 2021 version.

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

      If you're building a game to release go with the latest 2020.x LTS version, but if you're just learning then I'd recommend using the latest non-beta version! Does that make sense?

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

      @@JustinPBarnett yeah that makes sense, thanks. i do want to make a small first game so i'll stick with 2020, thanks!

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

    Can I use XR Interaction Toolkit with SteamVR plugin hands?

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

    Hello Justin, I like so much your videos. I have one question. I've followed your tutorial to try to do an inventory but at the moment I hide de canvas all the items that I have shocked falls down. What can I do to make the Items be hiden with the canvas and showed again. The inventory is a canvas with Slots that can be showed and hided pressing the button X of the left controler in Oculus quest 2. Thanks and best regards.

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

    Hello Justin. Could you please help me find out why I can see only black screen in my Oculus Quest 2? I step by step followed the first section 'How to set up a VR project in Unity 2021.2'. of video, Then I switched the platform to Android, selected device and pressed 'Build and run'. It created the apk and uploaded it to the quest but only thing I can see on my Oculus is black screen. Could you please help me what to do? I tried older Unity 2019, 2020 and it's OK but I would like to use Unity 2021. Thank you for awesome video!

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

      Hmmm maybe ask in the Discord. May need some screenshots or more specific details to help fix

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

      @@JustinPBarnett Do you have any example project in Unity 2021 configured for Oculus Quest I could try to run?

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

    Everytime i press play my hands are not attached, it just stay where it is and I can't see them, anyone knows how to fix this please ?

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

    Hey quick question, is there anyway to get a held input for my joystick? I'm trying to make a sprint system but I cant get an unpressed thing back from it, so I cant make the speed go back to the original when you unpress the joystick.

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

    There is no Default Input Actions under XR Interaction Toolkit Samples

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

      It's changed to another name, but still in the same place

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

    Hi guys! I want to ask that how can i address an xr origin in code? Sorry if it's a stupid question but i can't find a solution on the internet.

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

      It's the "XROrigin" class!

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

      @@JustinPBarnett Hey Justin!
      Could you explain this please?

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

      @@leventebotos6927 join the discord and we can answer more detailed

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

    I followed all these steps yet interaction toolkit does not come up

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

      You typed it in correctly to the package manager?

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

      @@JustinPBarnett Yes even re did it a couple times too. And tried different versions of Unity. How is that possible?

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

      @@OTAKUBLOCKU Strange.... does it show up in 2020 for you if you enable pre-release packages?

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

      @@JustinPBarnett yeah that’s what’s so weird about it. I do have an “error refreshing packages and features,see console” in the package manager.
      In console it says;
      “Cannot perform upm operation: unable to perform online search:”
      And
      “Error searching for packages”
      My wife is connected though.

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

      @@JustinPBarnett okay I figured it out I needed to create a new rule for my firewall to accept unity updates from internet. Thank you for responding.

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

    how do you use the socket interactor to trigger code events

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

      In the inspector there should be interaction events you can attach scripts to

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

    Xr toolkit inputfield active perform tha meta quest pro

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

    damn i thought this was gonna be about web sockets :(

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

    How weird; my Socket Interaction's Hover Mesh isn't in a static location, but follows/rotates with the object I want to put in! Even more so, it's not even IN that object, it's some distance away

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

      Very strange. Sometimes socket stuff has a mind of its own