Showing results for 
Search instead for 
Did you mean: 

Unity Hand Tracking collision with rigid bodies such as walls, tables, etc.

Level 4

Does anyone know how I can set up hand tracking in which my hand does not go through tables, walls, etc. to increase immersion?



Yeah I would also love to know if anyone knows how to do this. I have been playing around with the Physical Chess piece example from the example hand tracking demo but I can't get that function : TouchHandGrabInteractor to work with anything outside of the demo... 

Here's a high level overview of how I do it. I'm using a configurable joint to have the hand follow the controller.


First I use a joint hand and add capsule collider for each finger joint and a box collider for the palm. Each finger joint needs a rigidbody with no gravity, and the wrist joint needs a rigidy body too, no gravity with freeze rotation of XYZ (to match the rotation of the controller). You can also use box as a "hand" to keep it simple. On that box you would need a box collider and a rigidbody with no gravity with freeze rotation on the XYZ (so the hand roation matches the controller).


I parent an empty game object under the LeftHand Controller. On that game object I add a rigid body with no gravity and isKematic checked. Also on that object I add a Configurable Joint, and assign The Wrist or Box as the Connected Body. Under the Configurable Joint; set the X Drive, Y Drive, Z Drive positon spring to 10,000, Position Damper to 100, and Maximum Force to 10,000 for all 3 of those.


Then Play the scene. The collider or box hand should not go through objects that have colliders, and snap back to the controllers position when a collider is not in the way.


I can't speak to your question about the TouchHandGrabInteractor not working. I would check the scene in which it does work, and see if there are any other game objects in the Hierarchy that might be needed in a new scene. There also might be some scripts on objects that you interact with that are also needed.


Anyways I hope that helps! If you have different paremeters for the configurable joint that work better please let me know.