Introduction to VR in Unity - PART 8 : SNAP ZONE

Поділитися
Вставка
  • Опубліковано 22 лип 2020
  • In this video, I will show you how to help you player interact with your world with drop zone that snap the interactable to a predefined position and triggers custom behavior.
    ❤️ Support on Patreon : / valemvr
    🔔 Subscribe : www.youtube.com/@ValemVR?sub_...
    🌍 Discord : / discord
    🐦Twitter : valemvr?lang=en
    🔥 Tiktok : / valemxr
    👍 Learn VR Development : www.youtube.com/@ValemTutoria...
    NEXT EPISODE : • Introduction to VR in ...
    PREVIOUS EPISODE : • Introduction to VR in ...
    ····················································································
    📝Best VR Assets ( These links are Affiliate links which means it costs the same to you and I get a small commission. Thanks for your support!)
    VR Interaction Framework
    assetstore.unity.com/packages...
    Hexabody (Physics VR Player)
    assetstore.unity.com/packages...
    Mirror and Reflection for VR
    assetstore.unity.com/packages...
    Auto Hand (automatic hand grab pose)
    assetstore.unity.com/packages...
    Hurricane VR (vr physics interaction)
    assetstore.unity.com/packages...
    3d Hand Model for VR
    assetstore.unity.com/packages...
    ····················································································
    Full Series on How to make a VR game • How to Make a VR Game ...
    ····················································································
    If you want to learn VR dev, here are some other really good channel you should appreciate :
    ⌨️ Game Dev
    Brackeys : / @brackeys
    Dani : / @danidev
    Code Monkey : / @codemonkeyunity
    👨‍🎓 Vr Dev
    Valem Tutorials : / @valemtutorials
    Justin P Barnett : / @justinpbarnett
    Vr with Andrew : / @vrwithandrew
    ····················································································
    #vr #vrdev #madewithunity #valem #unity
  • Ігри

КОМЕНТАРІ • 117

  • @ValemVR
    @ValemVR  9 місяців тому +1

    Hey guys ! I made an update of this series on my channel Valem tutorial that you can find here : ua-cam.com/video/fM0k2n7u8sc/v-deo.html

  • @sotogje
    @sotogje 4 роки тому +40

    You are always suprising me offering the exact tutorial I am looking for

    • @jordyatondo1004
      @jordyatondo1004 4 роки тому

      Ikr, I literally needed this yesterday, lol.

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

    I love this series

  • @mironco9595
    @mironco9595 4 роки тому +3

    Yay! I really like this series! Thanks for another episode

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

    Another excellent tutorial! And it is funny... I was about to work on creating drop zones for attaching swords and potions to a belt, but you saved me a bunch of time. Thanks again :)

  • @LivanderGamedev
    @LivanderGamedev 4 роки тому +1

    This is what I've been waiting for!

  • @curranh.8328
    @curranh.8328 4 роки тому +1

    You are very skilled. Great tutorial! Thank you for bringing this to the masses! 😁

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

    i realy like how motivated you are in every video :D

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

    Thank you so much! This helped me with my holsters, I love how it is extremely simple and intuitive.

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

    Thanks Valem 😁

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

    keep up the good work ! thx for the tutorial series 👍🙂🙂

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

    thank you for this high-quality info

  • @AdrianMeredith
    @AdrianMeredith 4 роки тому +6

    this is great! how about some enemies next? would like to know how to physically interact with another character with that lightsabre?

  • @Dunzz100
    @Dunzz100 4 роки тому +1

    Gracias c: tus videos son de mucha ayuda.

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

    That's great, nice tutorial!

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

    This is awesome!!

  • @devincollins4804
    @devincollins4804 4 роки тому +1

    This is great! I always check my feed for when you release new videos! Is there a way to connect this snap zone functionality to a trigger? Say, inserting a card to open a door?

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

    Another mind-blow! Haha!

  • @piotrt.3652
    @piotrt.3652 4 роки тому +1

    Hello, Valem thanks for this amazing series! I have one question maybe you know by any chance how to programmatically force interactor (hand) to put some interactable (let say ligthsaber) in hand and then also programmatically remove it from hand (direct interactor)?

  • @sambrown2427
    @sambrown2427 3 роки тому +3

    Thanks again for the tutorials. I would love to learn how to make the snapzones not scoop up items I pass by. I only want items I place in them via hover to get grabbed. I've tried some solutions with no success yet.

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

    Thanks valem! :)

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

    how TF did you not get 1M view?, this tutorial is very good and explained really well.

  • @MouiTV
    @MouiTV 4 роки тому +1

    Great videos! It would be great if you could make a video showing how to replace the hands in steamVR into custom ones, there is very little information on how to do this and seems quite difficult!

  • @wrath6692
    @wrath6692 4 роки тому

    Nice thank you for the tutorial c:

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

    Great Tutorial. Can you snap multiple objects to the one point if they are different heights?

  • @borkly7926
    @borkly7926 4 роки тому

    Can you teach climbing next? Great vid btw!

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

    THANKS! :D

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

    Hey Valem, thank you for all of the work you've done on this series. I used to make GearVR games, and took a few years off. Now getting into Quest development with the help of your tutorials.
    I was wondering if we could see how to make functions that respond to the Touch Triggers being held down. Like a gun that charges while held down, and shoots on release. It doesn't seem like there is any equivalent to "GetButtonDown(0)" for the touch controllers.
    Thanks again!

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

      Yeah I wish you could just do something like "Input.GetAxis("LeftTouchControllerTrigger");"
      I just had to make my own input manager and get the variables that has for each input from other scripts.

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

    Hey Valem really enjoy your tutorial. One question considering Socket Snap Zones in XR. Is there a way that I restrict my snapping zone? So my Gun has a specific Snap zone that no other object can snap to. E.G. via a Tag. So only a Gun with a "Gun Tag" and the Snap zone with the Tag "Gun Snap" can work/snap togehter? Would be nice to have this additional info.

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

      A year late but in the xr socket interactor theres a tab that says interaction layer mask, set it to the layer u want and only objects within that layer can snap into it.

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

    Is there any easy way to resize the object inside the socket without having to extend the XR Socket Interactor? I tried to resize the "Attach Transform" scale, but it didnt work. Looks like the attach transform is used only to get the position and rotation. Thanks in advance! Valem your videos videos are awesome!

  • @HaelSturm12
    @HaelSturm12 4 роки тому +1

    Keep it up 😛😇

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

    Hey I was just wondering if there was a better way to track grabbed objects as I like the physics collisions of the velocity tracked movement type but I don't like the jittering when moving whit continuous. Is there a better way of doing it?

  • @meeperhere
    @meeperhere 4 роки тому +3

    Valem: only uses box colliders and sphere colliders
    Mesh Collider: Am i a joke to you?

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

      The Mesh Collider is more accurate when it comes to establishing collisions, but on the other hand it can give problems and inaccuracies when Unity has to calculate its physics. Whenever you can, use a box collider.

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

      @@PhantomWolf93 I feel like whenever I have a problem with collisions being detected it is because I'm using a mesh collider, way less problems with the other types. Idk what the problem is.

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

      A Convex Mesh Collider Will Work Though

  • @Corysia
    @Corysia 4 роки тому

    Yay!

  • @polar1991
    @polar1991 4 роки тому +1

    Do you have any experience with unreal engine? If you do can you make a series on it?

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

    Very nice job!
    Just one question, just noticed that if I have the two inventorys (left and right) when I continuous turn, I see like with less fps and is not fluent, not SMOOTH and If I disable the two inventorys changes and has a smooth turning move. Any way to solve this? I really want to have inventory and a normal turn, not stuttered and the only hint I have investigating is that is caused by the "Follow To The Side" script, that causes the turn to be less smooth

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

    do you have a video for OVR and oculus quest 2 not using XR interaction toolkit

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

    Hey is it possible to make the dropzone look like the object which needs to be grabbed?

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

    What i have to do to add in the "FollowToTheSide" Script, that i can adjust the rotation of the Drop Zone?

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

    It wasn't entirely clear to me what the follow math was doing, but to me, if you want something which basically follows your position and direction you are facing, and offsets but only taking into account Y rotation, I'd do something like:
    transform.rotation = Quaternion.Euler(0f, target.transform.rotation.eulerAngles.y, 0f);
    Matrix4x4 m = Matrix4x4.TRS(target.transform.position, transform.rotation, target.transform.localScale);
    transform.position = m.MultiplyPoint(offset);
    This seemed to work for me (it gave me inventory slots which were always below my head, around my waist, on the left and right.

  • @Duckamoly
    @Duckamoly 3 роки тому +5

    Dani *uses your tutorial*
    his subscribers *SUBS TO VALEM OUR AMAZING VR LORD*

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

    Thx

  • @nepal4190
    @nepal4190 4 роки тому

    hey, do you know how to make a working spin the wheel in vr?

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

    Can you plz make a video about locks and keys and maybe number padlocks?

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

    Would it not make it easier to child the obj to the head with the offset?

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

    any idea how to do it with the standard oculus integration?

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

    Lol, I had a cool bug where the door and drawer from the previous tutorial are grabbables, and so when I opened the drawer it would collide with the inventory dropzone that was following me around and completely break the physics!

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

      Did you fix it? I have the same problem.

  • @n.vano.7529
    @n.vano.7529 4 роки тому

    Merci pour tes vidéos que je découvre en ce moment, dommage qu'elles ne soit pas en français 😉 signé : un camarade de Bxl ✌🔥!!!

  • @adgjl822
    @adgjl822 4 роки тому +6

    Can you do a video like "how to make a body in VR" but with Unity XR now?

  • @kennl66
    @kennl66 4 роки тому +1

    Is the XR Socket Interactor broken in Unity 2019.4.1f1? Mine is not grabbing anything i put in the sphere, it just falls through. I have a sphere collider set to trigger and added the XRSocket interactor but it's not working. (FIXED) read SilweriFPV comment here, has a fix for the XR Socket Interactable not working with URP. I just tested it and now works on the Quest.

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

    ive spent about two hours trying to replicate this and I cant actually get anything to snap into the socket or even seem to register a collision

  • @samcasters
    @samcasters 4 роки тому +8

    Woudnt you be able to put anithing 9n your head is there a way to make it so you kan only put things on your head with a specific tag

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

      A bit late, but for anyone still looking for this. Check out his second tutorial on creating a realistic gun, there he gives a script to extend the socket interactor with a tag.

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

      @@charlottedegooijer4536 Thank you!

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

    Is anyone else getting an InvalidOperationException: Collection was modified; enumeration operation may not execute error whenever they put something inside of an XR Socket Interactor?

  • @ndonkey
    @ndonkey 3 роки тому +9

    Hey I'm having a bit of an issue. On your code when i walk by the draws the the draw and door get sucked up into the inventory slots. I have tried making a couple of changes but seem to make it all work or all break :D Is there anyway to set it so only certain layers can use the inventory or the object has to be held in the hand and dropped before being added to the drop zone?

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

      Did you manage to solve it? I'm using the Interaction Layer mask to do it but you have to do it on every grabbable item

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

      @@rikusoulz I some what just got around it. From memory I put the inventory areas into a new layer and allowed them to interact with standard grab items but not the doors, draws, levers, etc. It worked for what I wanted and it meant nothing else needed changing.

  • @silwerifpv8395
    @silwerifpv8395 4 роки тому +4

    Thank you for this excellent tutorial series! I'd like to report a bug that I found with XR Interaction Toolkit with URP on oculus go. Same issue might be with quest? XR Socket interactable is not working when project is using URP. Could you test this project on quest and see if the same bug remains?

    • @silwerifpv8395
      @silwerifpv8395 4 роки тому +5

      Found the bug in XRSocketInteractor script on material creation on lines 74-88. After replacing the lines 74-88 with below code, the snap zones work on Oculus Go (possible issue on Quest too?):
      if (m_InteractableHoverMeshMaterial == null)
      {
      // create of default transparent shader
      var m_InteractableHoverMeshMaterial = new Material(Shader.Find("Universal Render Pipeline/Lit"));
      if (m_InteractableHoverMeshMaterial)
      {
      /* m_InteractableHoverMeshMaterial.SetFloat("_Mode", 2);
      m_InteractableHoverMeshMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
      m_InteractableHoverMeshMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
      m_InteractableHoverMeshMaterial.SetInt("_ZWrite", 0);
      m_InteractableHoverMeshMaterial.DisableKeyword("_ALPHATEST_ON");
      m_InteractableHoverMeshMaterial.EnableKeyword("_ALPHABLEND_ON");
      m_InteractableHoverMeshMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
      */
      m_InteractableHoverMeshMaterial.SetColor("_Color", new Color(0.0f, 0.0f, 1.0f, 0.6f));
      }

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

      @@silwerifpv8395 yes this is an issue on quest if you run the game it just not there no sockets whatsoever

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

      @@silwerifpv8395 Thank you so much, this fixed the issue with XR Socket Interactable not working with URP :)

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

      I also found this issue on Oculus Quest. Thanks a ton for finding the bug and the fix! I was about to remove URP from my project but with this fix I will continue with URP!
      Also I am not sure if we need to comment out those m_InteractableHoverMeshMaterial setters (between /* and */). I left them in, only changed var m_InteractableHoverMeshMaterial = new Material(Shader.Find("Standard")); => var m_InteractableHoverMeshMaterial = new Material(Shader.Find("Universal Render Pipeline/Lit"));. Apparently Unity team forgot to change this line of code (still trying to find Standard shader). With this one line code change Socket Interactor works as expected on Oculus quest.

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

      @@silwerifpv8395 Thanks for finding this fix, dude!

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

    Next tutorial idea how to make a sword attack an enemy or something like that

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

      That's just normal unity stuff, nothing specific to VR really. Except for that you're experiencing it in VR. Just take a collider and when it touches the enemy make the health go down.

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

    Hi this tutorial is great and everything working when testing in unity though the link. but when i build and run it to my quest headset, the socket stuff is just gone it no visible socket zone on hover no predetermined object in the slot nothing. has anyone else had this problem. everything else works, even the climbing, just not the sockets.

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

      I have the same problem. Did you find a way to fix this?

  • @heldoct6154
    @heldoct6154 4 роки тому

    Can u make VR android with controller? Not use oculus but other controller??

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

    Imagine making an inventory out of this

  • @gabrielcharlessanchez6729
    @gabrielcharlessanchez6729 3 місяці тому

    Can I apply this in 3d not vr?

  • @doriondouglas6176
    @doriondouglas6176 3 роки тому +5

    How do you make it so only one specific object can be put into a drop zone? Like with the hat, you could put anything on your head. I wanma make a key system but I dont want a gun in there. I guess I could just use a function that checks if its that exact object, but you will be able to put anything in there.

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

      I guess you can just play with the layers. Look at the "XR Socket Interactor" component of your DropZone. You can chose the layer it is interacting with.

    • @Mtech7752
      @Mtech7752 3 роки тому +3

      Okay I just did it. Follow my steps. Lets say I want to make a holster for my Lightsaber. And the light saber will be the only thing I can attach to it.
      1) Create a dropzone like in the video.
      2) Create a layer called "Light Saber Holster".
      3) In the "XR Sockets Interactor" component of your dropzone, there is a line called "Interaction Layer Mask" wich is set to "everything". Put it to "Light Saber Holster" only.
      4) Now look at your Light Saber. It has a component called "XR Grab Interactable". There is the same parameter called "Interaction Layer Mask". It is set to "everything". You will notice you can attach your LightSaber to your Holster just like that. But, we dont want any other object to be able to attach to that holster. Here is the trick. You have to change the "interaction layer mask" of every other object to uncheck the layer "Light Saber Holster" that we created.
      It is a bit long, but in the end its very effective. Because you dont have to change the layer of any of your objects, just the layer mask. If not, you wouldnt be able to grab them anymore. Tell me if you have a problem.

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

      @@Mtech7752 I'm trying the route of a custom function so I can just check the tag of the object being held in the snap zone, but I can't get it to work, it just says NOT A FOX everytime even if it IS tagged as "fox":
      public void IsItAFox(Collider other)
      {
      if (other.tag == "fox")
      {
      Debug.Log("Yes, it's a fox hovering");
      }
      else
      {
      Debug.Log("NOT A FOX HOVERING");
      }

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

      @@Mtech7752 hey just found this comment 2 years later. I appreciate you going through and doing it (youtube never gave me a notifcation so i never knew! haha) but thank you for going through the effort, it is much appreciated.

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

    How to make sound when the controller hits any object ? Can any one help me please ?

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

    Valem I have a problem - When I use the socket interactor with an object that has the offset interactable instead of the standard one, the attach transform doesn't work. Is there any workaround for this? Thank you in advance if you reply.

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

      I am having the same issue, it grabs the object but won’t let me set the location

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

      Same issue here. Did you ever figure out how to use an offset grab with the socket?

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

    Why is my snapzone can sometimes put the things in, sometimes not??

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

    Hi . I follow all steps but still the snap not working for me

  • @jacobfoster9358
    @jacobfoster9358 3 роки тому +3

    How about a tutorial on how to make an object grabable with both hands at once?

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

      this is what i need. i have already tested it with the OVR stuff i have a working two hand rifle. but i just dont know how to use two hand holds with the XR toolkit.

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

      @@adhochero6619 Hey, I just found exactly what you were looking for. There are three videos that can help you out with doing two handed weapons / objects. Check them out! Here's the link on the first video, I hope it will help
      ua-cam.com/video/IX2EUAcocoM/v-deo.html

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

      He made one :) Part 10 ;] ua-cam.com/video/Ie0-oKN3Lq0/v-deo.html

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

    The socket interactor doesn't work when you build the game ):

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

    where can i find these assets?

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

    Hey valem, maybe you know the UA-camr Dani (he has 1 mill subs) and he used your tutorial lol

  • @Ss-kk4ep
    @Ss-kk4ep 3 роки тому

    My object enters the ball but when I want to take it out it stays there it does not connect to me at all does anyone know what the reason is?

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

      I was searching for this comment cuz i have the same problem. Any solutions ?

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

    Please someone help me! I can drop object in mu dropzone, but I can't take them out of the dropzone. Can somebody help me?

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

      hi Tim, do you have an error showing in the console ? :)

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

      Valem Hi! No, I don’t have an error. It’s like when the object (Unity cube) is in the drop zone (sphere), it seems like they just don’t collide. I’ve done just as you did in your video. I’ve checked the collission matrix, but there is everything is normal there

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

      @@TimT26 have you checked is trigger on the sphere collider? As in the drop zone collider?

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

      @@TimT26 have you fixed it ? I have the same problem

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

    the objects fly away

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

    If this works and don’t waste 20 minutes of my time you a big saver❤

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

    I am just gonna say this You should do udemy course with the latest content and a project within it that'd be great

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

    Regarding the script for the movement of inventory slots with the character. If u want it to follow in the same manner as "CapsuleFollowHeadset" from previous tutorial, replace the FixedUpdate with this:
    void FixedUpdate()
    {
    transform.position = characterTransform.TransformPoint(character.center);
    transform.eulerAngles = new Vector3(0, VRCamera.eulerAngles.y, 0);
    }
    i did not include the offset because I just need this for inventory slots around the belt of the player, for me orienting the gameobject is enough since I track the height.
    I placed three sphere objects with the socket component under an empty game object that has the script with the code above. Hope it helps.
    Btw, if anyone knows how to make the whole character not go through walls please let me know, the code from the tutorial series did not work for me.

  • @aminer3v695
    @aminer3v695 4 роки тому

    Are you french ?

  • @pizzaguy6099
    @pizzaguy6099 4 роки тому

    Am I able to sell a game with your source code

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

    None of these tutorials don’t work for me

  • @lukenowlandfilms
    @lukenowlandfilms 4 роки тому +4

    Is Unity paying you? Unity should pay you.