It may not be perfect BUT without touching C# we can have a simple drawer mechanic on our VR environment using just Unity XR tools and other components; we are using the same logic we use on our Doors on Part 7.
On my Scene I have a Bookshelf asset, how is divided depend on the assets but the approach in this article is the same.
I selected the drawer_l_top_01 and added the necessary components: Rigidbody and Configurable Joint.
The Rigidbody must have Use Gravity none checked and where it says Constraints have all Freeze Rotation checked.
Configurable Joint is the component that will make everything works. Use the image below to have a idea how to configure the component, Linear Limit can vary depending on the asset your using.
I created a empty game object inside the drawer_l_top_01 to be my “handle”. The “handle” has a few well known components.
Be aware the settings that each component has; Box Collider must have Is Trigger check, remember that the XR Grab Interactable component must have the same Interaction Layer Mask has the the one that you use on your XR Player hands.
There are 5 game object that are behaving as my colliders, they all have just box colliders components that are going to make “adding object” inside my drawers more easy.
This is my way to tackle this, you can just add a Mesh Collider component to the drawer object itself BUT depending how the object is made there is a high chance the collider won’t allow you to put object inside the drawer.
On my Bookshelf there is another empty game object that is behaving a a stopper for drawer_l_top_01. This drawer_stopper_l_top only has a box collider component and is position is behind the drawer that we are going to interact; his purpose is to NOT let the drawer go far back when we “close” it.
🎮TO BE CONTINUED🎮