How to Make a VR Game in Unity 2022 - PART 5 - Hover, Grab and Use Interactable

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

КОМЕНТАРІ • 345

  • @ValemTutorials
    @ValemTutorials  2 роки тому +110

    No cubes were harmed in the making of this video.

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

      I am getting a namespace error

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

      Hi i just notice when i grab the cube and moove my controller close to my body so close to my hitbox the cube is coldie whit my hitbox and i fly
      je pense que tu es français alors au cas où la hitbox du cube entre en collision avec la hitbox de mon personnage et me fait donc voler, j'aimerais savoir si c'est possible de corriger ça? en tous cas super vidéo sinon :D

    • @SgtMacKerZ
      @SgtMacKerZ Рік тому +2

      @@prso5587 Looks like this started off in English and slowly trailed off into French? :)

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

      @@SgtMacKerZ yes because i think this guy is french like me x)

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

      @@prso5587 I thought it started English and slowly started changing to French as it went on. But now I think you just wrote it in English and in French as well afterwards? My mistake

  • @SSnapse
    @SSnapse Рік тому +31

    Script for the gun (make sure the name of the script is the same as the name in the video):
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.Interaction.Toolkit;
    public class FireBulletOnActivate : MonoBehaviour
    {
    public GameObject bullet;
    public Transform spawnPoint;
    public float fireSpeed = 20;
    // Start is called before the first frame update
    void Start()
    {
    XRGrabInteractable grabbable = GetComponent();
    grabbable.activated.AddListener(FireBullet);
    }
    // Update is called once per frame
    void Update()
    {

    }
    public void FireBullet(ActivateEventArgs arg)
    {
    GameObject spawnedBullet = Instantiate(bullet);
    spawnedBullet.transform.position = spawnPoint.position;
    spawnedBullet.GetComponent().velocity = spawnPoint.forward * fireSpeed;
    Destroy(spawnedBullet, 5);
    }
    }

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

      thank you

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

      it says the script cant be loaded because of compiling errors any ideas?

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

      @@alexanderbirdie125 Are you sure the name of the script is the same as shown in the video?

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

      THANKS!

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

      OM, Thank you very much!

  • @givemepen0
    @givemepen0 2 роки тому +35

    Loving this series, it's been an absolute god send for me

  • @SoundEffekts2
    @SoundEffekts2 Рік тому +55

    If anyone is having trouble with their gloves not picking up/selecting anything- make sure to check off the "Is Trigger" box on each of your gloves! Took me four hours to figure that out

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

      I had the same problem, thanks man!

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

      Could you explain this further please?
      The left hand and right hand Sphere collider, turn of the is trigger?

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

      omg thank you i spent about 1 hour

    • @Alm0nd-p8o
      @Alm0nd-p8o Рік тому

      You're a genius

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

      You might also have an issue of your collider not being centered on your controller object. Make sure your controller AND the collider are starting at the same position (0,0,0).

  • @AriyaBayat
    @AriyaBayat 8 місяців тому +10

    If attach transform is not working for you:
    go to the game object who's attach transform you'd like to manipulate during runtime
    add an XR Single Grab Free Transformer component to it
    inside your XR Grab Interactable component, scroll to the bottom until you see Grab Transformers Configuration and expand it
    add an item to the Single Grab Transformers list and drag the XR Single Grab Free Transformer component you just added to that new empty slot
    run the game and manipulate the attach point to your liking
    you can then reverse all of this to get things back to "normal"
    was driving me nuts as well, hope this helps, good luck!

  • @jaifien7356
    @jaifien7356 2 роки тому +16

    You should do a tutorial series on Ultimate XR for unity. It’s a new VR toolkit that was released last month, free for commercial use

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

    I am glad you fixed the collision bug at the end because I knew it was going to be a problem as I have dealt with it before and wasn't sure you would cover it. Layers are great.

  • @petermcrory5194
    @petermcrory5194 Рік тому +7

    Great series Valem! Thanks so much for this new course. :) Super cool you're sponsored by Unity!

  •  2 роки тому +7

    13:34 you should not check equality on float. And you are checking an analog input (trigger) which may never be 0 (zero). You better check it with a threshold something like x < 0.1f . Great tutorial by the way, saved tons of time. Thank you.

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

      Good remarks ! Better play it safe you're right

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

      HI hello i have the same issue, i can take the gun but not move by teleport enymore. How can i fix this? i change the value of == 0 to this < 0.1f but dosent work. Im using HTC vive controllers. By the way awsome tutorials @Valem Tutorials.

  • @boogiehasfun
    @boogiehasfun 3 місяці тому +1

    something i learned is that the ground should have a box collider, since sometimes the cubes can phase through the ground if it goes straight down

  • @IronBee_official
    @IronBee_official Рік тому +2

    I did the script myself, Its so fun, I start to understand how things work

  • @skudgee2
    @skudgee2 Рік тому +2

    Your videos are addictive ! Can't believe it's already ep.5

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

    Hello Valem. I am a huge fan of yours and very thankful for you. Would It be possible to make a tutorial on inventory? This would be much appreciated. Thanks, Henry

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

      Hi henry thanks for watching the video, I'll take note on that idea it can be nice for a future tutorial thank you. :)

  • @Yolakx
    @Yolakx Рік тому +7

    Code for teleportation
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.Interaction.Toolkit;
    using UnityEngine.InputSystem;
    public class ActivateTeleportationRay : MonoBehaviour
    {
    public GameObject leftTeleportation;
    public GameObject rightTeleportation;
    public InputActionProperty leftActivate;
    public InputActionProperty rightActivate;
    public InputActionProperty leftCancel;
    public InputActionProperty rightCancel;
    // Update is called once per frame
    void Update()
    {
    leftTeleportation.SetActive(leftCancel.action.ReadValue() == 0 && leftActivate.action.ReadValue() > 0.1f);
    rightTeleportation.SetActive(rightCancel.action.ReadValue() == 0 && rightActivate.action.ReadValue() > 0.1f);
    }
    }
    Be sure to have the same names as in the video.

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

      Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you...

    • @PixelGame_
      @PixelGame_ 8 місяців тому +1

      Thank YOU SO MUCH BROOOOOOOOOO

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

    Excellent video for studying VR development! Everything was done. Thank you!

  • @Noah-sw5xw
    @Noah-sw5xw 2 роки тому +3

    wuuuuhhh new episode

  • @Sushanth-m3o
    @Sushanth-m3o 11 місяців тому +2

    For those who have motion of character ,throwing character away while picking box,make sure you reduce your capsule collider radius

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

      THANKS!

  • @vasurabadiya2436
    @vasurabadiya2436 10 місяців тому +1

    Very informative thanks for this amazing video brother.

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

    Thanks Valem! These have been great tutorials.

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

    so cool thanks mr Valem

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

    I assume the issue evident at the very end of the video where the attach transform only works with one hand (the right in your case) will be solved in the next video? My attach transform for the pistol looks fine for the right hand, but is too far right when holding in the left hand, so the hand is not centered on the grip of the pistol.

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

      Yes! I am having the same problem, have you found anything out??

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

      @@carsonlohr2781 Hey - in the next video he creates a class that inherits from the base Grabbable class and can attach a transform for each hand so you can modify each to each hand. Hit me up if you can't find it and I can send you the code, no worries.

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

    Great tutorial as always, is there also a way to make a two hand grab or maybe even a custom grip, for exampale if you hold a gun it put the hand on the trigger etc.

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

      Custom hand pose for will be cover soon ! For two hands grab I've made a previous video on the subject here : ua-cam.com/video/Ie0-oKN3Lq0/v-deo.html
      But I know that Unity is planning on adding it in future update of the unity xr toolkit :)

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

      Ah thank you ill defenitly take a look a the two hand tutorial!

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

    i love this im actually making a vr game thanks for the help man

  • @petermcrory5194
    @petermcrory5194 Рік тому +17

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.Interaction.Toolkit;
    using UnityEngine.InputSystem;
    public class ActivateTeleportationRay : MonoBehaviour
    {
    public GameObject leftTeleportation;
    public GameObject rightTeleportation;
    public InputActionProperty leftActivate;
    public InputActionProperty rightActivate;
    // Update is called once per frame
    void Update()
    {
    leftTeleportation.SetActive(leftActivate.action.ReadValue() > 0.1f);
    rightTeleportation.SetActive(rightActivate.action.ReadValue() > 0.1f);
    }
    }

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

      Thank you boss

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

      You are the best, I thought I was going crazy it wasn't working for me

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

      @@reflexclutch1571 did you succeed with the bullet script ?

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

      ty

    • @Mr.Frenzyguy
      @Mr.Frenzyguy 11 місяців тому +1

      @@reflexclutch1571 Had the same exact script wasn't working, copy paste, it worked....wtf ahahah (I know it's 1 yr later but this guide is still super useless)

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

    Great tutorial, helps a lot.

  • @OramiIT
    @OramiIT 8 місяців тому +1

    @ValemTutorials, I have noticed that right hand/left hand requires different attach points. Is there a built in way to select which attach point is used (I created two per item) based on what hand is grabbing the item?

  • @Ony_
    @Ony_ Рік тому +3

    2:01 when adding the XR direct interactor i get an error messege saying "Can't add XRDirectInteractor to right controller becaus a XRRay Interactor is already added to the game object!
    a game object can only contain one XRbaseInteractor component."

    • @Vs-ub4tq
      @Vs-ub4tq 11 місяців тому

      Deleting the line indicators or whatever they're called seems to fix the issue.

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

      @@Vs-ub4tqhow?

  • @Bill-us8nn
    @Bill-us8nn 2 роки тому +2

    Great video, thanks so much. Would you say this updated Unity VR solution is better than the one in your older video?

  • @jya-pc4821
    @jya-pc4821 7 місяців тому +2

    I've been following all the previous tutorials and when I get to the 1:58 mark and add the XR Direct Interactor it will not let me because I already have the XR Ray Interactor. Should I delete one of them? Would that not remove the teleportation rays I made before?

  • @r4ndom-here
    @r4ndom-here 2 місяці тому

    is there a way to change the trigger/button that you have to use for the grabbing system? Love your tutorials :D

  • @sullina3
    @sullina3 10 місяців тому +1

    the "live editing" of the attach point you're doing at 8:45 isn't working for me at all. I can edit the attach point when the program isn't running, but that's requiring a lot of trial and error...

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

      Hey man, do you have any answer to this problem, because I have the same situation and after 30 minutes I put my model in the right position, but it takes a long time.

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

    Hi, how were you able to move the attach transform while you were not in your headset at 8:57.
    Whenever i take off my headset the screen blacks and the game kinda pauses itself

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

      put ur finger on the things that say 1 2 or 3 and it tricks it into thinking u ahve ur headset on

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

      @@HalfTayem Thank you :)

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

    can you make a tutorial on how to make the force in unity like in the oculus game Vader Immortal?

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

      Interesting topic I'll look into it :) thanks for watching

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

    super helpful tutorial. do you plan on making a video on how to make the player jump?

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

      Maybe in a future video dedicated to jumping in VR, I think it's interesting how with VR you can actually jump using something else than just the press of a button.
      Like press + moving both hands up like in lot of game.

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

    Was fun, feels almost like half life VR :))
    I hope exist tutorial how to make animations for each different object.

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

    Hey, could you teach us how to code a sword like in Blade and Sorcery?

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

      Would be nice :) chop some trees in jungle

  • @skortle4529
    @skortle4529 Рік тому +5

    Hey, I followed the tutorial and I'm having an issue at 12:19, For some reason the Bullet, Spawn Point, and Fire Speed options won't come up, Any way to fix this?

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

      I have the same problem, did you ever fix it?

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

      @@thenoseguy Sadly not, I've given up on my VR Project for now :(

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

      @@skortle4529 I figured it out. Just gimme a sec to remember how I did it.

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

      @@skortle4529 What I did was I copied the code exactly without copy and pasting anything. I got it wrong the first time because I copied and pasted some random guy's "copy" of the code and it didn't work. Just have Visual Studio and UA-cam open at the same time.

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

      make Shure there are no errors and that all of the code as a ; at the end of the line

  • @aasciutti
    @aasciutti 5 місяців тому

    I'm having problemas with the Attach Point. It creates an attach point in the Right Hand controller, and it uses it instead of the empty object I created. But this attach point only appears in Play mode, so I can't add it as attach point to the pistol.

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

    I can't fire the bullet...i have problem with script

  • @Sam-by3jq
    @Sam-by3jq 2 роки тому +3

    I've gone through the whole series and it's awesome and things are working great but I have one issue.
    While holding an object in one hand I am still able to grab it with the other, which makes some weird movement happen since the item is trying to match both hands, how would I fix this?

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

      If you get a reply let me know.

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

      @@carsonlohr2781 I have a solution that works. Might not be the most elegant but it isn't too bad.
      1. create an Attach Point for both Right and Left hands (attached to the Pistol object). Remember to adjust the values when playing BUT copy them when not playing.
      2. Either add a second script to the pistol or extend the Fire Bullet On Activate (should prob be its own script)
      3. The script will need public variables for Left/Right Attach Points and corresponding XR Direct Interactors. Entire script will be at the end to keep the instructions at the top!
      4. Drag each of the GameObjects (attach points & interactors for both right and left hands) into the exposed variable slots in the editor.
      5. Run the game and see that it works. For fun, I duplicated the pistol so i could dual wield!
      Here's the script I currently have:
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.XR.Interaction.Toolkit;
      public class FireBulletOnActivate : MonoBehaviour
      {
      public GameObject bullet;
      public Transform spawnPoint;
      public float fireSpeed = 20;
      public Transform leftHandAttachPoint;
      public Transform rightHandAttachPoint;
      public XRDirectInteractor LeftHand;
      public XRDirectInteractor RightHand;
      XRGrabInteractable grabbable;
      void Start()
      {
      grabbable = GetComponent();
      grabbable.activated.AddListener(FireBullet);
      grabbable.selectEntered.AddListener(UpdatePosition);
      }
      public void UpdatePosition(SelectEnterEventArgs arg)
      {
      Object selectorHand = (Object) arg.interactableObject.firstInteractorSelecting;
      if (selectorHand == LeftHand)
      {
      grabbable.attachTransform = leftHandAttachPoint;
      }
      else if (selectorHand == RightHand)
      {
      grabbable.attachTransform = rightHandAttachPoint;
      }
      else
      {
      Debug.Log("Something's Broken");
      }
      }
      public void FireBullet(ActivateEventArgs arg)
      {
      GameObject spawnedBullet = Instantiate(bullet);
      spawnedBullet.transform.position = spawnPoint.position;
      spawnedBullet.GetComponent().velocity = spawnPoint.forward * fireSpeed;
      Destroy(spawnedBullet, 5);
      }
      }

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

    Hey, I've been loving these videos and I found them really helpful. But there's one issue. When I made the "Fire Bullet On Activate" script it doesn't compile and when I restart the tab, it says "The associated script cannot compile" I also have an issue where the Attach Point on the gun doesn't move the actual gun. I have to guess and check but eventually I get a really good position where it fits in the right hand perfectly, but then the left hand is super off. Any fixes for either of the two??

  • @Q21-x6v
    @Q21-x6v 6 місяців тому

    Hello. That's a fantastic video! Is there a way to set the movement type to Velocity Tracking in the Meta XR All-in-One SDK?

  • @KlaudiaBereczki
    @KlaudiaBereczki Рік тому +2

    Hi! Your tutorial is super useful, thank you! :)
    I have a problem I could not fix though - I grab my weapon, let it go, grab again - works perfectly. But once I shoot, I cannot grab it again. Do you have any idea, why it could happen? I made a sci-fi scene with shootable ships, but the grabbing and shooting mechanisms are the same as yours.

  • @Shiffo
    @Shiffo 10 місяців тому

    I run into two problems:
    -> When I grab the pistol it seems to move if I use the right analog stick.
    For some reason the PistolObject uses the XR interaction Manager to move I believe.
    -> I am not able to grab the gun anymore. Even if delete the pistol and put it back in. Create a Colider and the xr grab interactible. it's broken.
    EDIT: I performed the seperation between Player Layer and Interactible layer, but still have this issue.

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

    Would you happen to know if there is a way to change how the hand grips around whatever object you are trying to grab?

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

      i think it grabs the center, so u have to make the center of the collider where the hand goes (tbh im a noob at unity but ig try it)

  • @rahmatriyadi3201
    @rahmatriyadi3201 Рік тому +2

    I have a problem, 4:58 when I grab the cube it doesn't turn yellow. it turns white when i touch the cube but doesn't turn yellow when i grab the cube

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

      I had a similar problem. For some reason I had a Direct Interactor as a child component of my hands, which did not work. I deleted those and multi selected "Left Hand" "Right Hand", then added the XR Direct Interactor and the Sphere Collider. Now it's listening to my hands.
      In other words, double check your XR Direct Interactor and Sphere Collider are directly on the Hand components.

  • @stryker2k2
    @stryker2k2 Рік тому +3

    Whenever I grab the cube, I get launched a thousand miles into the air. Has anyone else ran into that issue?

    • @stryker2k2
      @stryker2k2 Рік тому +2

      I figured it out thanks to an earlier comment (sorta). The cube was colliding with my body, sending it flying. So I put the cube and my body on two separate layers then unchecked where the met on the Physics matrix.

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

      @@stryker2k2 im having the same problem, i made an XRorigin layer and left the cube on default, but what do you mena by "then unchecked where the met on the Physics matrix." because I want to fix this issue but dont understand what that meant.

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

    3:05 OUR OLD HANDS!
    We've come so far

  • @motobike5Dev
    @motobike5Dev 5 місяців тому

    Your tutorial was excellent, but I'm having trouble with the grab function, in my scene i have an object to grab, so i grab it but i have a continuous rotation script on my right hand so whenever i rotate with that hand, the grabbed object doesn't rotate with the hand.

    • @motobike5Dev
      @motobike5Dev 5 місяців тому

      Nevermind, i found the problem. Great video again.

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

    hey, is that normal that when i try to grab an object the grab isn't grabbing but the pinch is grabing, how do i make some objects pinchable and other grabbable ?

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

    Fantastic tutorial! However, I am having one problem, when I try to move the attach point during runtime, nothing happens, so I need to guess and check when moving the attach point.

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

      I have this same problem?

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

      i'm having the same problem. have u found a solution for this?

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

      you can drop and pick up the item quickly while moving it in the inspector, this allows you to slowly move it bit by bit, but its kinda frustrating and slow. @@mansourzawad

    • @Vectif
      @Vectif 9 місяців тому

      Having the same issue. Is there not a setting to allow it to edit in runtime?

  • @garrett-bg9do
    @garrett-bg9do Рік тому

    amazing video, but my hands have red lines that let me pick things up from across the map

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

    Great Video thank you soo much

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

    the trick with moving the attach point while holding the gun doesnt work for me, the attach point works but i just cant do the trick

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

      Same for me, it only moves the attach point but the pistol is not moving, hence i have to let go and grab again the pistol so I can know if now the attach point is positioned correctly.

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

    Hi, I was wondering if it is normal for my oculus to like when I am testing my unity game I know this should not be right because I have a very new PC and it works fine playing any other game on oculus but once I test out my game. It likes uncontrollably.

  • @adityavardhan5625
    @adityavardhan5625 10 днів тому

    my interactions are not working when i use xr device simulator. I dont my headset with me ryt now, how do i solve this issue?

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

    Hey @Valem Tutorials, is there a possible way I can make a line for the pistol so I know where it exactly shoots?

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

      Just add a LineRenderer as a child to your pistol ! Position it correctly, and set it to enabled and disabled just like we changed the color of the cube on Select Entered and Select Exited (at 4:22)

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

      @@Xarius, thank you so much!!!

  • @matthewduncanson8744
    @matthewduncanson8744 Рік тому +3

    how do i get the XR Interaction Manager?

    • @tianzhi_he
      @tianzhi_he 8 місяців тому +1

      Go to Window - Package Manager (Packages: Unity Registry) - XR Interaction Toolkit (2.5.2) - Samples - Hands Interaction Demo - Click Import, then in the HandsDemoScene, you should be able to find the XR Interaction Manager under the "XR Interaction Hands Setup", you will need to copy paste it into your own Scene. Hope this can help you, took me so long to fix this. I think it's the XR Interaction Toolkit difference that causes the problem. 🧐

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

    Hello Valem! Great tutorial! Question:Why does my desk move back (keep away) when I grab for the cube ? 😂 Expecting a reply

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

      It doesn’t move away your just not moving forward because of the collision

    • @amaanraheem
      @amaanraheem Рік тому +2

      Change the size of your character controller component found within the XR origin so that you don't collide with the cube table. Make it slim, for instance radius, 0.1

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

      the cube is prob to far away, if you try to walk irl it wont let you

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

      He addressed this bug towards the end of the video. This is where he talked about setting the player and interactable layers. The cubes are causing a collision with your XR Origin, which in turn causes YOU to move backwards due to the physics interaction.

  • @Alejandro-yq6oy
    @Alejandro-yq6oy 2 роки тому +1

    Why when I put an object that I take with my hand, does it lift or move me?

  • @joelruiz1152
    @joelruiz1152 10 місяців тому

    If someone wanted to use the trigger in order to grab certain objects, and the grip button to grab other objects, how might this be accomplished?
    Not me, asking for a friend, ofc.

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

    Is there a way that you can make it a different grab like a trigger grab?

  • @Rohityoyo1997
    @Rohityoyo1997 5 місяців тому

    When I try to throw the cubes away in the plane... the cube just somehow bypasses the plane and start falling. Can someone please help?

  • @MrDruw.
    @MrDruw. Рік тому

    so when I try to grab the cube it doesn't do anything.

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

    How do I edit the attatch point for both hands? For my left hand the gun position is perfect but it makes it worse when I grab it with my right hand.

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

      Yes! have you found anything?? I cant find anything

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

      @@carsonlohr2781 So to fix this go to the attach point you have already created scroll down until you find a checkbox that says something like “dynamic attach”

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

      @@cloudd_08 where do i find that

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

    I have a problem. when I shoot the bullet goes to the left and not forward. How do I fix this?

  • @mirjamjahn3899
    @mirjamjahn3899 10 місяців тому

    Hi :) I can't find the XR Grab Interactable script if I want to add the component. Up to this point everything went pretty well and I installed the XR Interaction Toolkit as learned in the previous videos. What did I wrong and how can I get the XR Grab Interactable script?

  • @DavidRedmond-c7n
    @DavidRedmond-c7n Рік тому +1

    Really love your video's so helpful and thorough. Can I ask with the script at the start for making the teleport ray disappear, I implemented everything and it works perfectly on one hand but not the other. hand , the trigger appears but does not cause the user to teleport. I have double checked and both hands are set up the same way I have also tried remaking the ray components and then it switched where the hand that was working the first time round was broken the second time and visa versa. Any thoughts or help greatly appreciated.

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

      Did you find a fix for this? I also have my rays working but the teleporting won't go off. If I disable this script, teleporting works fine

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

      Hey so I fixed by resetting the XR Controller component, make sure each interactor has it's own tied to the game object

  • @Wintxrシ
    @Wintxrシ 9 місяців тому

    Hey Valem! I am using your tutorials to create my VR Game. But for some reason the game is very laggy even with good settings a 1.5 GBPS link cable and a good pc it still lags with quest link! I have tried to use Virtual desktop but it doesn't open. What do you use to stream your game to your headset? I need to know!

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

    Great Videos!! Thanks Valem. One Question. Since I can set my glasses to not turn off, I can't find any options. It gets complicated every time I want to test something that has to turn on controllers and goggles.

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

    Is it possible to teach us how to activate the teleportation only while the thumbstick is pushed forward, and make it disappear if the thumbstick is released? this way it's possible to control when the teleport is active and cancel the action. Text instructions will be more than enough. I tried this myself but I don't know how to use the Vector2 value to trigger activation. Thank you so much for everything you do.

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

      teleporter.SetActive((inputAction.action.ReadValue().y > 0.1F));
      This works for me using the Locomotion/Teleport Mode Activate action on the teleporter game object

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

      @@martwoods Thank you, sir! That .y after vector 2 is exactly what I needed! I had figured it out, but I hope this can help someone else.

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

    Hi, after adding the interactors and interactables the game gives me an error that Direct interactor does not have required collider set as a trigger. I also noticed that on the direct interactor on the interaction manager tab, for me it said none and for you it said it had one.

    • @yoOtzel
      @yoOtzel Рік тому +2

      hi, the error might come from not checking "isTrigger". go to your hand object -> sphere collider -> check is Trigger

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

      @@yoOtzel Yup its this. I had the same problem, thanks for the help.

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

      @@Sssenstional i'm glad i could help ;)

  • @TheAniMateChannel
    @TheAniMateChannel 8 місяців тому

    I have a problem where I always spawn at ground level. Resetting my position in vr fixes this, but it's kinda annoying to have to do that every time. Can anyone help? Great tutorials BTW :D

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

    Maybe a silly question - but how are you managing to adjust the attach point transform so well while in game? In order to change the settings in Unity I have to let go of the controllers, take off the headset etc and it was not a smooth process at all

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

      i had same problem. you solved it?

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

      @@juanbrincadeira no, i ended up just copying his values from the video but i also want to know how to do it conveniently for future use

    • @PeterBickhofe
      @PeterBickhofe Рік тому +2

      You can try to switch the "attach point compatibillty mode" to legacy for ajustments and then switch back to default. Guess its the newer toolkit version...

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

      @@PeterBickhofe Thanks for the tip, will try that!

  • @TechCircuitBreakdown
    @TechCircuitBreakdown Рік тому +2

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.XR.Interaction.Toolkit;
    public class FireBulletOnActivate : MonoBehaviour
    {
    public GameObject bullet;
    public Transform spawnPoint;
    public float fireSpeed = 20;
    // Start is called before the first frame update
    void Start()
    {
    XRGrabInteractable grabbable = GetComponent();
    grabbable.activated.AddListener(FireBullet);
    }
    // Update is called once per frame
    void Update()
    {
    }
    public void FireBullet(ActivateEventArgs arg)
    {
    GameObject SpawnedBullet = Instantiate(bullet);
    SpawnedBullet.transform.position = spawnPoint.position;
    SpawnedBullet.GetComponent().velocity = spawnPoint.forward * fireSpeed;
    Destroy(SpawnedBullet, 5);
    }
    }
    working code

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

    For some reason it only shoots when I grab it and won’t shoot unless I let go and grab it again and every time I press the thumb sticks it moves away from me can you help me please

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

    For the Fire Bullet script, can someone make it so they dissappear after colliding with something else, I have tried attempting this for so long yet it doesn't work. Help much appreciated.

    • @blackmagegamestudio
      @blackmagegamestudio Рік тому +2

      You wouldn't add that to the Fire Bullet script. You would attach a script to the bullet prefab. The below script should help you out... Basically in the OnCollisionEnter function, you check to see what the bullet collided with. We need an exception for the pistol (you could make this more items too for more gun types). So long as it passes the IF check, then we call the Destroy function on the gameObject that the script is attached to (ie the bullets).
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class DestroyOnCollision : MonoBehaviour
      {
      void OnCollisionEnter(Collision collision)
      {
      if (collision.gameObject.name != "pistol")
      {
      Destroy(gameObject);
      }
      }
      }

    • @StatusTechDev
      @StatusTechDev Рік тому +2

      @@blackmagegamestudio oh I already got this working, thank you though!

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

      @@StatusTechDev I figured since the post was a month old... BUT... dropped the comment in case someone else has the same question!

  • @ZaferAli-ox3re
    @ZaferAli-ox3re Рік тому

    I can't subscribe to Patreon and I can't access your "[EXCLUSIVE] Making a Mini Golf VR Game in 40 minutes" video, can I access it in another way (I'm from Turkey) Please Help

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

      Hi Zafer that's weird you should be able to access everything with the last tier did you message me on patreon ? I cna send you the link directly otherwise

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

    some of you might get weird behaviors if you dont set the istrigger on for the two hands !! took me an hour to find out what the problem was and thought i might share it and save you some time :)

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

      Thank you , This solved my problem

    • @go.outside2
      @go.outside2 Рік тому

      thanks man, helped me too

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

    For some reason I cant put my hands over my table, i've arranged the height f the table many times but my controllers cant reach the cube. Please help

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

    Hi, great tutorial. I have one question, I made a sword model that I can grab, but while using velocity tracking it lags behind my hand. Anyone else encountered this problem? Thanks.

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

      @weHLDWNmiRWfxmvyKHzF Sorry not sure how you would fix this. I decided to go with Hurricane VR where this is solved.

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

      @weHLDWNmiRWfxmvyKHzF Oh 100%. It solves entire physics aspect quite well. If you would compare the time it would take you to create this system by yourself and paying $50 for the complete thing, it is definitely worth it

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

    i need some help whenever i get too close with my hands to an object i move a little bit backwards is there any way to fix it

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

      might be late but for me my fix was decreasing the size of the radius on the character controller.

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

    How can I make the bullet stop colliding with another bullet or the player when moving forward? Basically, how can I make the bullet speed = some value + the player forward velocity? FYI, this isn't a layer issue currently, although I realise I need to look into this.
    EDIT: I created a bullet spawner that shifts forward based on the player's forward velocity to handle this edge case.

    • @pastuh
      @pastuh Рік тому +2

      chatgpt suggestion.. need insert above line Destroy(spawnedBullet...:
      // Ignore collision between the spawned bullet and all other bullets.
      foreach (GameObject otherBullet in GameObject.FindGameObjectsWithTag("Bullet"))
      {
      if (otherBullet != spawnedBullet)
      {
      Physics.IgnoreCollision(spawnedBullet.GetComponent(), otherBullet.GetComponent());
      }
      }
      // Ignore collision between the spawned bullet and the player.
      GameObject player = GameObject.FindGameObjectWithTag("Player");
      if (player != null)
      {
      Physics.IgnoreCollision(spawnedBullet.GetComponent(), player.GetComponent());
      }

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

      @@pastuh note that FindGameObjects is expensive so should not be used where a large amount of objects need to be referenced in a short amount of time, say for example when trying to reference a lot of bullets from a machiene gun. For the odd reference its ok but better to reference another way than find if you can

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

    help my xr interaction manager wont transfer to new things automatically and sometimes i cant click the bullseye looking thing and search for it. idk what to do

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

    Sorry for asking this but.. What do when pistol is invisible?

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

    can someone help me i cant do the attach point part with the gun when i move the attach point hte gun dosent move????????????????

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

      Same for me, it only moves the attach point but the pistol is not moving, hence i have to let go and grab again the pistol so I can know if now the attach point is positioned correctly.
      Try letting go and grabbing again fast enough to see the change.

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

    When I grab anything: it's very jittery and doesn't like to follow my hand well

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

    When I pick up an object and then move the joystick of the same hand, the object moves with the joystick faster than I move, so the object leaves my hand. Is anyone else having this problem?

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

    12:20 the options under the fire bullet on activate aren’t showing up for me. How do fix this?

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

    bro someone pls help me. i copied the code for the bullet and got this error: Assets\FireBulletOnActivate.cs(15,29): error CS1061: 'ActivateEvent' does not contain a definition for 'Addlistener' and no accessible extension method 'Addlistener' accepting a first argument of type 'ActivateEvent' could be found (are you missing a using directive or an assembly reference?)

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

    Hey man, great tutorial, got cubes working fine tho when i tried making the gun interactable it just flies off as soon as i grab it. do u have any idea as to what i could've done wrong?

  • @SFG_Studios-f6u
    @SFG_Studios-f6u Рік тому

    hi valem, im having an issue with my gun when i shoot, the bullets just spawn en dont go any where. could you help me pls.

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

    HELP! When i add the activate teleportation ray script i cant drag anything into it, it is only one line and its the script. Now i cant go in to playmode and it says it is missing ILineRendareple ??? HELPP 0:45

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

    Great video, it helped me a lot to get started in the world of VR development.
    I have just one question, is there any way to prevent the objects I grab from colliding with the player's collider without having to do it by code?
    I don't know, any option in XR Origin itself?

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

    Problemm :Direct Interactor does not have the required Collider as trigger.?????

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

    When I set my grabbable objects onto a different layer, they disappear when I go into play mode 😮 I’m confused.

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

    hello any idea why my left controller uses select to grab the objects but my right controller is using the activate trigger, i can't find out where to change it and now i can really pick up the gun as the teleport always activates

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

    When holding objects and pressing thumbsticks in a direction the held item flies away

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

    Hi, I've got an issue. I cannot grab interactables with left hand controller. Right one works fine. Do you have any ideas how ould I fix this?

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

      You might have forgotten to add a collider with isTrigger set to true for the left hand.

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

    (FIX): my collider was not in the correct position reletive to the hands, make sure your sphere collider in both the right and left hands are at 0,0,0
    Currently having a problem with the objects interacting with my custom made hands in blender, i keep getting to message "NullReferenceException: Object reference not set to an instance of an object", also im having problems with the teleportation ray/radical showing (i have the right hand unchecked but the left wont work), can anyway please help me.

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

      Idk if this helps, but i got the ray/radical working, and realized that it turned white when the ray was touching the cube, if i click trigger it turns yellow.

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

      holy shit, actual savior ty!