Thank you for the tutorial, this really helped me, one thing, I have encountered a big..if the object is colliding with two slots at same time, both slot will act as full but only one will get the object, so I had to check count of Child for slot gameobject to reset it null after every frame end
Glad you enjoyed it! You can follow the same logic/ideas of the video and make the code equivalent of what I have on your desired platform/headset. It won't work with other devices if you take the same code and copy step by step tho.
For the Inventory VR script on the private void update function for the first if statement what do I change the OVRInput to if I’m using the new XRorigin controller? plsssss helppp
the easiest way would be to make a public XRController in the script and drag your xr controller onto it in the inspector, then make a function like public bool IsButtonPressed() { bool buttonDown; lefthandcontroller.inputDevice.IsPressed(InputHelpers.Button.PrimaryButton, out buttonDown); return buttonDown; } that will check for if the button is pressed
it should be noted though, that if you do not have the coding knowledge for this part you're going to have a very difficult time when it comes to coding the grab events since he modifies the OVR code for grabbing directly, so you're going to have to make your own system for XR interactions.
Thank you for this tutorial. I managed to get it to work but I ran into a bug that if the grabbed object has a big enough collider it can collide with 2 adjacent slots at the same time which changes the ItemInSlot property for both slots, rendering one of the slots unusable afterwards (since it thinks there's an item in there). I wonder what's the best solution to tackle this issue? EDIT: I solved it by adding tag "Slot" to all of the Slot game objects. Then I wrote this script to detect if an object is colliding with another game object with a "Slot" tag and attached it to all the Item game objects. using System.Collections.Generic; using UnityEngine; public class ColliderList : MonoBehaviour { [SerializeField] protected List m_colliders; public List getColliderList { get { return m_colliders; } } private void Start() { m_colliders = new List(); } private void OnTriggerEnter(Collider other) { GameObject obj = other.gameObject; if (obj.tag == "Slot") m_colliders.Add(obj); } private void OnTriggerExit(Collider other) { GameObject obj = other.gameObject; if (obj.tag == "Slot") m_colliders.Remove(obj); } } Finally, inside the OnTriggerStay function for the Slot script I've added an additional check: if (obj.GetComponent().getColliderList.Count > 1) return; This makes sure if you release a grabbed Item while it is colliding with more than 1 Slot, the Item will not get inserted. I've also run into another bug: If your Slot is colliding with an Item while you're releasing another Item currently being grabbed that isn't colliding with any Slot(s), the collided Item will get inserted into the Slot. To fix this, I added the followings to the Slot script: bool lastFrameGrabbed; void Start() { ... lastFrameGrabbed = false; } private void OnTriggerStay(Collider other) { ... if (OVRInput.GetUp(OVRInput.Button.SecondaryHandTrigger) && lastFrameGrabbed == true) { InsertItem(obj); } lastFrameGrabbed = obj.GetComponent().isGrabbed; } The code will check whether the colliding Item was in a state of being grabbed on its very last frame before being released, if it was, then proceed with the insertion.
For the Inventory VR script on the private void update function for the first if statement what do I change the OVRInput to if I’m using the new XRorigin controller?
How to I make it so, as soon as you start the game all game objects with a “inventory” tag will be in the inventory and make them infinite ( so you can grab and throw as many gameobjects as you want and that gameobject will still be in the inventory?)
I have the same problem. In my code editor, there is a message that say "This file is part of the Unity Package Cache. Any changes made will be lost". If anyone knows how to modify it, we will apreciate it.
@@Wayloz really? Awesome sweet. I am a decent programmer as I know the basic fundamentals from taking C++ classes, just not so much the server data base stuff with multiplayer. I’ll see if he has any vids
@@tacticalmythic7945 Multiplayer is definitely a huge task in any game, it's exponentially harder than a singleplayer game. Now everything has to be networked reliably, I'm glad you're confident and have experience but personally I'd recommend completing a singleplayer project first to a degree where you don't need to rely on many tutorials. Pretty sure Jason Weimann has a video saying similarly. Whichever path you choose to take, goodluck.
Thanks for this tutorial! I almost got it to work. I can open and close the inventory. drag objects into it, but the problem is i cant get them out anymore. I don't know what went wrong. I've tripple checked the code and everything is exactly the same as with your code. One suspicion I have is that Unity said I had to switch from the standalone Input module to theInput System UI Input Module because the standalone input module uses an old inputManager. Any advice of what needs to be setup differently with this new inputsystem? Please HELP!!
Hi @sybiote, yes I fixed it. The issue was that I used a different Grabmäler script that in this video there are two different ones one called OVR grabbable and one just called grabbable. I don’t remember which one is the correct one to use. U can also use both haha (guess it’s not very efficient) but i needed to use both as only the grabbable script allows two hand interactions which I needed as well. Hope this helps ;)
it says can't add script 'Slot1' (also inventory) because the script class cannot be found. Make sure there are no compile errors and that the file name and class name match. How do I fix this?
@@RealaryVR for example, if I put iron and wood in a box and press a button, it will be connected, for example, to a shovel, but made so that everyone can come up with recipes and add
Thank you for the tutorial, this really helped me, one thing, I have encountered a big..if the object is colliding with two slots at same time, both slot will act as full but only one will get the object, so I had to check count of Child for slot gameobject to reset it null after every frame end
best tutorials ive ever found
Thank you appreciate the kind words!
is there a way to do this with OpenXR instead of oculus? (using valem tutorials Let's Make a VR game series but I wanted to add an inventory)
Really helpful, what is needed to use this with Auothands, as I'm getting numerous compile errors?
Thank you so much for these tutorials
Glad you like them!
This is what i wanted !! Thank you
You're welcome!
Great Tutorial
But a question here can I use this method for other vr devices also or not?
like for openvr devices
Glad you enjoyed it! You can follow the same logic/ideas of the video and make the code equivalent of what I have on your desired platform/headset. It won't work with other devices if you take the same code and copy step by step tho.
Great video!! Really appreciate it.
Thank you!
For the Inventory VR script on the private void update function for the first if statement what do I change the OVRInput to if I’m using the new XRorigin controller? plsssss helppp
Have you found the solution?
the easiest way would be to make a public XRController in the script and drag your xr controller onto it in the inspector, then make a function like
public bool IsButtonPressed()
{
bool buttonDown;
lefthandcontroller.inputDevice.IsPressed(InputHelpers.Button.PrimaryButton, out buttonDown);
return buttonDown;
}
that will check for if the button is pressed
it should be noted though, that if you do not have the coding knowledge for this part you're going to have a very difficult time when it comes to coding the grab events since he modifies the OVR code for grabbing directly, so you're going to have to make your own system for XR interactions.
hi, very good work, we must continue to make videos,,, ;)
Thank you, yes we should!
can u do a tutorial on a quest system for vr i have tried looking every where but i cant find a way i aint good at coding so ur help would be nice
How did you convert 3D object to 2D sprite in this video?
he didnt. They are just fixed in a position in the center of the square
Thank you for this tutorial. I managed to get it to work but I ran into a bug that if the grabbed object has a big enough collider it can collide with 2 adjacent slots at the same time which changes the ItemInSlot property for both slots, rendering one of the slots unusable afterwards (since it thinks there's an item in there).
I wonder what's the best solution to tackle this issue?
EDIT:
I solved it by adding tag "Slot" to all of the Slot game objects. Then I wrote this script to detect if an object is colliding with another game object with a "Slot" tag and attached it to all the Item game objects.
using System.Collections.Generic;
using UnityEngine;
public class ColliderList : MonoBehaviour
{
[SerializeField]
protected List m_colliders;
public List getColliderList
{
get { return m_colliders; }
}
private void Start()
{
m_colliders = new List();
}
private void OnTriggerEnter(Collider other)
{
GameObject obj = other.gameObject;
if (obj.tag == "Slot") m_colliders.Add(obj);
}
private void OnTriggerExit(Collider other)
{
GameObject obj = other.gameObject;
if (obj.tag == "Slot") m_colliders.Remove(obj);
}
}
Finally, inside the OnTriggerStay function for the Slot script I've added an additional check:
if (obj.GetComponent().getColliderList.Count > 1) return;
This makes sure if you release a grabbed Item while it is colliding with more than 1 Slot, the Item will not get inserted.
I've also run into another bug:
If your Slot is colliding with an Item while you're releasing another Item currently being grabbed that isn't colliding with any Slot(s), the collided Item will get inserted into the Slot. To fix this, I added the followings to the Slot script:
bool lastFrameGrabbed;
void Start()
{
...
lastFrameGrabbed = false;
}
private void OnTriggerStay(Collider other)
{
...
if (OVRInput.GetUp(OVRInput.Button.SecondaryHandTrigger) && lastFrameGrabbed == true)
{
InsertItem(obj);
}
lastFrameGrabbed = obj.GetComponent().isGrabbed;
}
The code will check whether the colliding Item was in a state of being grabbed on its very last frame before being released, if it was, then proceed with the insertion.
For the Inventory VR script on the private void update function for the first if statement what do I change the OVRInput to if I’m using the new XRorigin controller?
@@lucaspicanco9649 yahh me too need like that
would this work for openxr too thanks
How to I make it so, as soon as you start the game all game objects with a “inventory” tag will be in the inventory and make them infinite ( so you can grab and throw as many gameobjects as you want and that gameobject will still be in the inventory?)
i couldn't modify grabbable script do you know why?
I have the same problem. In my code editor, there is a message that say "This file is part of the Unity Package Cache. Any changes made will be lost". If anyone knows how to modify it, we will apreciate it.
@@singular-lb2hh sad part is you can't modify it you can only inherit from it.
@@singular-lb2hh in other words you have to come with different solution
Great Tut! How would this work with hands?
Is your UI Package compatible with hand gestures?
Could you explain how grab objects, like a gun, with hands control?
Hi Diego! Go to the playlist from the link in the description. There are videos about hands, grabbing, distance grabbing, and also a gun tutorial.
Can you make a tutorial on how to host your own server and join others using VR and how to access a internet browser with this keyboard like TH-cam?
I believe Valem has a tutorial series for VR Multiplayer
@@Wayloz really? Awesome sweet. I am a decent programmer as I know the basic fundamentals from taking C++ classes, just not so much the server data base stuff with multiplayer. I’ll see if he has any vids
@@tacticalmythic7945 Multiplayer is definitely a huge task in any game, it's exponentially harder than a singleplayer game. Now everything has to be networked reliably, I'm glad you're confident and have experience but personally I'd recommend completing a singleplayer project first to a degree where you don't need to rely on many tutorials. Pretty sure Jason Weimann has a video saying similarly.
Whichever path you choose to take, goodluck.
Hey, for me the website doesnt seem to work. Please Let Me Know If Its Just A Me issue
Hi! Our website was down due to some issues. It's back up now 😊
thanks dear you place put link for item and slot script
Is there a way to make this capable with steam vr?
i dont have no oculus folder
Thanks for this tutorial! I almost got it to work. I can open and close the inventory. drag objects into it, but the problem is i cant get them out anymore. I don't know what went wrong. I've tripple checked the code and everything is exactly the same as with your code. One suspicion I have is that Unity said I had to switch from the standalone Input module to theInput System UI Input Module because the standalone input module uses an old inputManager. Any advice of what needs to be setup differently with this new inputsystem? Please HELP!!
i have the same issue, did you find a fix?
Hi @sybiote, yes I fixed it. The issue was that I used a different Grabmäler script that in this video there are two different ones one called OVR grabbable and one just called grabbable. I don’t remember which one is the correct one to use. U can also use both haha (guess it’s not very efficient) but i needed to use both as only the grabbable script allows two hand interactions which I needed as well. Hope this helps ;)
@@simons3943 ok thanks a lot
it says can't add script 'Slot1' (also inventory) because the script class cannot be found. Make sure there are no compile errors and that the file name and class name match. How do I fix this?
I'm a bit late but does the script name inside of the IDE, the name before : MonoBehvaiour, match the script name in the editor?
Hi, why does the code that I typed in GrabBegin disappear when I hit play?
also why does my VR folder only contain Scene folder?
Make tutorial fór crafting unity vr
Hi Matyas, can you explain more what you mean by crafting?
@@RealaryVR I think he means crafting from mimecraft
@@RealaryVR for example, if I put iron and wood in a box and press a button, it will be connected, for example, to a shovel, but made so that everyone can come up with recipes and add