VR Development — Day #3
In this article, we will look at two ways for grabbing an object. First is using Kinematics technique, then have a look at using Fixed Joint technique, and then we will settle on combining the two.
This technique is making the grabbed object a child of the hand, making it kinematic during that phase ensures that gravity does not have an influence on it, and if it bumps into something, it won’t fly away.
In the GrabbableObject script, make the following changes.
In the Grabber script, make the following changes. This will check if the grip button has been pressed and call the object's grabbable code.
I am going to into Synty Studios POLYGON Starter Pack — Low Poly 3D Art by Synty. It is free in the Unity Asset Store. Import into the project.
Go to Edit > Render Pipeline > Universal Render Pipeline > Upgrade Project Materials to UniversalRP Materials and click Proceed to fix the materials.
I did a little bit of level design by creating a level and throwing in some props. I put a Rigidbody and the GrabbableObject script on the sword and two water pistols. This is how it runs so far.
As a small improvement, we know that when we put a GrabbableObject script on an object, we need to add a Rigidbody component…