Grasping For Progress : Physics-Based Hands!



This Game Needs a Hand

Both metaphorically and literally. This game needs some hands so we can actually interact with the world. Only problem is, that means modeling hands, and I have no clue how to do that. But, no time to learn like the present!

After lots of hard work, pain-staking effort, and tons of YouTube videos, we ended up with something like this:




Physics!

Now that we have hands, I need to actually put them into the game. To do that, I wanted to use physics. Through the use of Unity's built-in physics system, it's possible to create hands that can follow player controllers and properly interact with the virtual world.

When the hands collide with objects in the game with realistic physics, the immersion of the game rises instantly. It makes the player like a part of the world rather than viewing it as a spectator. However, doing all this requires some math. After hours of trying to figure this math out, I had only one option...

So, one quick Ctrl-C, Ctrl-V later, physics have been added to the game. Quick thanks to @JustinPBarnett for the great video on physics-based hands.

However, while the hands collide with objects and follow the hands, the rotation is a bit broken.




Stabilization

The hands look like I've had a few too many cups of coffee.

To fix the jittering, I played around with 2 different variables: Rotation Follow Speed, and Angular Drag. After sorting trying some combinations of these, I finally settled on 2 values that calmed my hands down.


Position Threshold

One last error with the hands is the ability to get them stuck. Since the hands follow the position of the real-life controllers, and they collide with everything, it's possible to get the hands stuck behind a table or outside the map. This means you'd be missing a hand. The only way to get it back is to find where your hand got stuck, and guide it out. However, this can get really annoying once it happens a couple times. To fix this issue, along with a few other glitches that come with the physics, I decided to add a position threshold.

A position threshold just determines how far away the virtual hand is allowed to be from your controller. Once the distance between the two increases past the threshold, the hand is teleported to the controller's position. This way, if the hand gets stuck, it'll just teleport right back to you.


Finished Product

And there we go! After a few more hours than I'd like to admit for something this simple, there are working physics-based hands! We can push objects around, left them up, and toss them, all through physics. There is just one last thing to do...

Animation

As much as it scares me, we can't really have a game without animation. But, I've run out of time in this devlog, and I have yet to actually make it, so this will be something I deal with in the second part of the creation of the virtual hands.


I hope you enjoyed this first update on the game. To learn more about the game, take a look at the game page at:

Little Laboratory Game Page

Hope you all have a great day!

Leave a comment

Log in with itch.io to leave a comment.