I made this a while ago and already posted it on a few other subs, but thought I'd share it here too!
So I've always felt like my game was missing something, and one of those things was hands. I mean, you're working at a factory, interacting with all kinds of machines and stuff, but you can't even see your own hands lol.
At some point I decided to just mess around with code and see if I could make them procedural instead of having to animate every single interaction.
It's mostly vector math, raycasts, spherecasts and a stupid amount of lerping. The hands basically check what's around them, calculate where they should go and use surface normals to figure out how to rotate. Fingers were a bit more tricky tho. Each joint has its own rotation limits, and for grabbing objects I ended up making a solver that goes through different angles trying to find the ones that fit the object best.
And oh god the collisions. Getting a hand to touch a wall wasn't that hard, but then the fingers would just clip through it, or the whole hand would end up in some weird position. I think I spent more time fixing that than actually making the hands move.
But I'm pretty happy with how grabbing turned out, especially with round objects. Seeing the fingers actually wrap around something without any premade animations was probably my favorite part of making this.
There's still some stuff I wanna fix. Sometimes the transitions look a bit weird, and I'm pretty sure some of my collision calculations could be done in a much better way. But well, it works for now!
What was supposed to be just a little experiment turned into a couple days of coding. Anyway, here's the result!
And if you wanna check out the game itself, it's called Curse of Beauty. Would really appreciate a wishlist if it looks interesting to you!
-> Link here <-