How to grab a part
Set a part as grabbable
Every physicalized object can be manipulated using your virtual hands easily.
To do so, you can right click on your gameobject in the Unity hierarchy, and select INTERACT > Scenarize > Make part grabbable.
This will add an Xde Asb Part component.
Every physicalized part that has an Assembly part component will be interactable in your virtual scene.
Physicalized parts are now grabbable
Parts are made grabbable during physicalization as we consider most of these parts aim to be manipulated. It will save you precious seconds when preparing a scene. If you don't want a part to be grabbable you can disable the Grabbable
property in the XdeAsbPart component.
It will still follow the physical properties of your object. Thus, you can manipulate a lever and a wheel while respecting the kinematics. Weight is also considered. If your object is too heavy, you won't be able to lift it and your fingers will slip around the object.
Grabbable depending on the player used:
-
When you try your virtual scene using an HMD, you will be able to grab the object when holding trigger. If you want your virtual fingers to react with grabbable object, you can set collisions between the player and your object.
-
You can also manipulate grabbable part using the runtime desktop player. Click and hold on a part. You should be able to drag your part using a virtual elastic interaction.
Manipulate a part
You can manipulate a grabbable part either with controller or with a hand tracking device (Leap Motion or Manus VR).
Grabbable objects can be physicalized, in that case you need to activate the collisions between your hand and the object or not.
How to customize grasping manipulators
When using grasping an object in Interact, virtual couplings will be created between your part and your virtual hands. These coupling act quite similarly to spring attached from your fingers to your object.
This work both ways: grabbed part will be lifted by your fingers, but will also incur some force to pull your fingers.
These advanced parameters can be tuned in XdeGraspManipulator component. This component is automatically added and is located in your player hierarchy.
-
Grasp bodies: These bodies are the physicalized fingers in your virtual hands considered for grasping. By default, the whole hand will be considered.
If you want to manipulate tiny parts, like screws, we usually only use three fingers to do so. You can customize this grasp bodies list to only include to increase manipulation fidelity.
-
Target bodies: This is automatically filled when you start your simulation. Every physicalized object with an Asb Part component will be added. However, you can modify this list at runtime to prevent or allow an object to be grabbed.
-
Tau: This parameter is a response time in seconds for your grasping system. If you want your player to be stronger, you can decrease this value. By having a smaller value, your coupling will try to reach desired position faster, and will use more force to do so. On the contrary, you can increase this value for more simulation stability.
-
Attach min. distance: This parameter is in meters and will tune the maximum distance where we will stop trying to attach to the grabbed body.
Grasping strategies
Drop an object if it's too heavy
When you use your controller to grasp an object in a virtual scene, the weight and inertia of the object will be simulated. However, since you can still move freely in your real-world environment, there may be a discrepancy between the position of your real hand and the position of your virtual hand when you are holding a heavy object.
In such cases, it may be appropriate to drop the object so that the virtual hand can move freely to match the position of the real hand.
To configure this behavior, you can use the XdeGraspManipulator component. This component allows you to adjust the AutoDetach property and set a threshold that triggers the Ungrasp event. When the distance between the virtual hand and the real hand exceeds this threshold, any grasped object will be dropped automatically.
Disabling collisions when hands get stuck
In virtual simulations, it is possible for hands to get stuck in the virtual environment, leading to a discrepancy between the position of the virtual hands and the real hands. To address this issue, a fallback strategy can be set up to temporarily disable collisions between the hands and the CAD model, allowing the virtual hand to move back freely to the position of the real hand. Once the virtual hand has reached the real hand position, collisions will be reactivated.
To set up this behavior, the XdeHandRecoverer component can be used. The distance threshold that triggers the event can be customized to suit your needs.
Note
It is important to set the distance threshold to be greater than the AutoDetach behavior if you are using the previous strategy.
Disabling hands tracking when hands are too far
When your controller is too far from your HMD, your virtual hand is detached from the tracked controller and set to a hand rest pose. This prevent your arm from growing indefinitely if you place controllers on your desk and walk away with your HMD on.
To set up this behavior, the XdeAsbHandsSmartAttach component can be used. The distance threshold (between Head Node and Skeleton Node) that triggers the event can be customized to suit your needs.