ArachnoHand was a final project made for Animation Programming. I worked with one other programmer to create a character controller.
From the beginning, we knew wanted to create a character controller combining everything from the class. To that end, we created a "game" where you play as a hand, and it's your goal to ruin Christmas. Although, it more showcases the things we learned in class. FK, animation clips, clip blending, and IK/FK blend.
For me personally, I worked mainly on clips, FK blending, and the two of us worked together on IK/FK blend.
The clip controller runs on what I consider the "standard" implementation. And, I believe it's also the implementation that Jason Gregory uses in Game Engine Architecture. A clip consists of a list of keyframes, its time in the frame, which frame we're in, and the frame to go to next.
A keyframe is a position in the world for all bones of that skeleton, with how long the keyframe should last.
The clip controller handles updating the positions of all the bones, interpolating positions of those bones depending on the keyframe, and then returning the new positions of the bones. Note that I return the new positions, along with bone index. We built this in Unity, and ran into some bugs with letting the clip controller have total control over bone positions.
The DoClip() function does the interpolation of transformations, and then gives those back. That's used for blending.
Clips themselves are stored in an XML document that holds transformation data for each bone for each keyframe. Each clip is in a seperate file. We wrote a simple tool that would save bone transformations into that XML. We just load those in at the start.
Animation blending is just another layer of control on top of the standard controller. The blend controller takes in standard animation controllers. In my case, I only needed two clips, so I hard coded some bits of the blend controller. It could definitely be made a lot better than what I did, but, I'll be honest, I was very happy to get it working.
The blend controller updates all of its clips, gets the transforms back per bone, and then blends them together based on a normalized value between 0 and 1. The only blend control operation I used was a lerp for blending, but, other operations could be possible. I just created a parent class for creating blend operations.
When all is said and done from the blending operation, we'll have all of the positions, and then we can set the bone transformations appropriately.
Luckily IK/FK blend isn't actually that difficult in Unity. We were able to cheat around it a little bit thanks to Unity automatically doing FK for us. Ultimately, we can update IK and FK for one frame separately, and then blend them together at the end since Unity will automatically handle local to world transforms and vice versa.
Some more pictures down here of how the project turned out. It's not perfect by any means, but it was still great to work on!
Walking from the side
Grabbing an object