How to Eat in VR using the Unity XR Interaction Toolkit

Sdílet
Vložit
  • čas přidán 26. 06. 2024
  • I've gotten a SURPRISING amount of requests for a Unity VR tutorial about how to eat, so here it is! We're using the Unity XR Interaction Toolkit to set up all the interactions and some custom code for the eating bit. Follow along!
    🍗 Food Asset
    assetstore.unity.com/packages...
    📺 Watch Next: • What Do I Need to Beco...
    🥽 Enroll in the (now FREE) VR Creator Academy: skool.com/vrcreatoracademy
    ⌚ Timestamps
    0:00 Intro
    0:15 Project Startup
    0:51 Asset Used
    3:15 Consumable Script
    9:56 Consumer Script
    11:35 Testing Functionality
    13:26 Adding XR
    18:26 Outro
    #vr #eating #unity

Komentáře • 58

  • @mpschigoda1677
    @mpschigoda1677 Před 2 lety +10

    Super love that you go through the VR setup steps in each video. With the changes to the systems making the older videos harder to follow, this really helps!
    (like when they changed XR rig XR origin, and especially the way interaction toolkit gets added. Can't wait till that's out of pre release)

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

      Yea I find that it's just easier to re-cover that part for the people who are totally new and for those who want to see what changed! I can't wait till it's out of pre-release too

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

    Another awesome video. It was just fun to see how you would do something like this. Helps me learn more about how unity works, and how game dev works.

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

    I'm applying this to a project that is in no way a consume relationship, but works so well, thanks for making these videos man!!!! They're more helpful than you realize!

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

    dood your so clutch i actually needed this i was gonna do this today, btw you do awesome tutorials keep up the work!

  • @qualar
    @qualar Před 2 lety

    Not only are your videos accurate and straight to the point you also come across as a friendly guy. Great job

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

    Oh man! I wished i knew about the context menu earlier :D Thanks!

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

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

  • @Kai29FR_
    @Kai29FR_ Před měsícem

    Awesome and really helpful! Quick question though, how would you reset the index back to the start?

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

    Yay! I love eating in vr 😅

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

    thanks :)

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

    I absolutely love your videos and how you explain everything you do its extremely helpful. Think you could do a video on door physics? When I try to make a door I have issues with the hand glitching through the door instead of stopping on the door like a real life object. Thank you!

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

    Loved the video. Explanations and the hotkey on screen was a great add! good improvement. I love how I can actually implement this code to my project even when using Hurricane or VRIF. Keep up the good content.

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

    good work

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

    Great timing Justin! I was just about to try adding consumables in my VR project. Any chance you would be able to do a multiplayer VR tutorial in the future?

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

      Yes I want to sometime early next year!

    • @Updog97
      @Updog97 Před 2 lety

      Great, looking forward to it!

  • @lucutes2936
    @lucutes2936 Před 2 měsíci

    Thx

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

    I do not like notifications from youtube BUT you’re going to be my first(and last) channel with notifications ON

  • @hiteshkaplesh8084
    @hiteshkaplesh8084 Před 6 měsíci

    Please create a course on HTC vive using Steam Vr head tracking , hand tracking , body movements, interactions .

  • @sdhority
    @sdhority Před 2 lety

    Just out of curiosity, is there a reason you put the collision logic on its own Consumer script? I feel the same effect could be achieved by giving the consumer collider a tag then in the consumable script checking to see if the other collider has that tag. Really just curious if there's a specific reason you did it that way as either solution works.

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

    great video!
    Could you please make a tutorial on how to add more funcionality to interactables other than just through "Activate" with the trigger. Like, for example, if I wanted to make a VR remote and have it react to me pressing the face buttons or stick (on the controller I'm holding it with).

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

      Check out my “How to Jump” tutorial! I go over how to add another input for buttons

    • @matteomeysel
      @matteomeysel Před 2 lety

      @@JustinPBarnett I know, thanks, but how can I make it specific to an interactable, so the action only happens if I am holding a specific Object and pressing a button on the controller I am holding it with?

  • @Uncle_dervus
    @Uncle_dervus Před 7 měsíci

    hey can you make a tut how to make a gravity gun?

  • @wormholeinteractive
    @wormholeinteractive Před rokem

    Can this be done using events? Meaning, can you trigger sequential events using the new unity events system?

  • @TheGamingWiccan
    @TheGamingWiccan Před 4 měsíci

    how would i integrate this into a needs system like say hunger and thirst

  • @brunofvalli
    @brunofvalli Před rokem

    So the Box Collider is just on the meat part of the ham, but if I leave the ham in an upward position and let it fall to the ground the bone part get clipped because the Box Collider is around the Ham meat. Is there a way to fix this? I was trying to add another box collider to put around the bone, but that does not work at all.

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

    Sir Can you make tutorial with (XR simple interactable) When Right joystick trigger is pressed then color change and when left joystick trigger is pressed on the same object then it disappears...Thank You😊

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      Check out my input tutorial or how to jump tutorial!

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

    Do I have to buy XR toolkit to create this?

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

    the only challenge now for beginners is deciding to use the Oculus integration or the XR toolkit... Does anyone know any resources on how to use the Oculus version instead my app is designed for the quest 2 and i rather work with their software and tools instead of XR

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

      Join the discord and we can help you work it out!

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

    Hi guys! I want to ask that how do i address an XR Orgin in script? Sorry if it's obvious but i did not find it on the internet somehow. Happy holidays

  • @anglerfishgt
    @anglerfishgt Před 2 lety

    can someone help for some reason it saying syntax error,',' expected on this line [ContextMenu(itemName"consume")] can someone help me

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      are you missing a parentheses?

    • @AndyLong222
      @AndyLong222 Před rokem

      I was just helping someone debug this, so hopefully this comment helps...
      The 'itemName' is a hint from JetBrains. You DO NOT have to type it. The correct code here is [ContextMenu("consume")]

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

    I BEG YOU to please make a yugioh game for quest 2 please I am begging! 🥺

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

    Can anyone give me an advise! Everything works great with one food object, but if you put 2 or 3 food items close to each other they act as a consumer to vise versa. Please help with this.

    • @JustinPBarnett
      @JustinPBarnett  Před 2 lety

      You'll need to make sure that the colliders don't recognize the other consumable colliders!

    • @Semen128
      @Semen128 Před 2 lety

      @@JustinPBarnett Yes, it’s true. But how should I do It, if they all have a trigger colliders to correspond to Consumer?)

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

      @@Semen128 In that case it should only respond to the consumer collider

    • @Semen128
      @Semen128 Před 2 lety

      @@JustinPBarnett And recently I came up to a new struggle : ) I made a kitchen sink with a tap and script for the tap to refill ontriggercollider drinks with consumable script on it. I added this to consumable script for refill:
      public void ReSet()
      {
      for (int i = 0; i < portions.Length; i++)
      {
      portions[i].SetActive(i == 0);
      }
      }
      Everything works fine, but it changes the visuals, but it can't be consumed again and it's index shows 2, but not 0, as it should.