Grabbing objects with hinges – advanced VR hands

Yesterday I posted instructions on how to grab objects with your hands in Unity. This post included only the first steps. I created a video showing off the current implementation of my virtual reality hands.Grabbing items can be very straightforward, but when you start with that, you probably want to improve and improve such that the interactions grow more realistically.

One of the thing I definitely wanted to support was hinges. The world is full of objects which are connected by hinges: doors, steering wheels, buttons, knops, levers. When you grab those in VR using the straightforward implementation, the object will disconnect. This results in holding a door in the air for example. So I improved the implementation such that when a rigidbody is grabbed which is connected with a hinge, the hand movements are limited such that the object will behave as it is connected by a hinge (ha!). Actually I am implementing a part of the physics engine of Unity in the case the object is kinematic.

Besides that I also spent quite some time on having the fingers behave more naturally. An object is grabbed when is is hold between the thumb and the fingers. Moreover, the fingers are curling around the object as if I am really grabbing it, preventing the fingers to penetrate the object.

It is still a bit rough, but I is getting there: