top of page

Inverse kinematics

and

animation

Game Engine II

For DePaul's Game Engine II course, I implemented an Inverse Kinematics solver, as well as an animation backend, for my custom game engine, both in C++.

Animation is critical to a game's success, and with procedural animation becoming more common, Inverse Kinematics is needed.

IK and FABRIK

The solver I used for Inverse Kinematics is known as FABRIK (Forwards and Backwards Reaching Inverse Kinematics). It is a simple algorithm that works in two parts.

 

For the "Forwards Reaching" part, it points bones in an IK Chain towards their destination, and moves them towards it. The "Backwards Reaching" part pulls all of the bones back into place.

This algorithm requires an understanding of world transform matrices, and unit vectors.

I was selected by the instructor to present my project to the class. The presentation can be found here, with a longer explanation of IK nuances. (Along with animation)

Animation

Ultimately, animation is merely the manipulation of values over time.

 

My animation system uses simple linear interpolation between matrices and vectors to provide the user an easy interface to set timestamps and values to animate quickly.

 

Animations are defined by a hashmap to "AnimationChannels" -- components of an animation, such as interpolations of individual body parts. These AnimationChannels cointain a circular linked list of "Keyframes" that can contain a matrix or a vector. A time value is passed in, and an interpolated matrix or vector is passed out.

These are stored in AnimationControllers via a hashmap to associate animations with names. Under the hood, the controller has a pointer to its current animation within the hashmap, and the user passes in names to change the animation.

RESULT

The result is a simple, easy to use interface for creating and animating game characters with IK Animations.

A definite improvement to the system would be adding in bezier curve support to allow the animation's interpolations to be more nuanced.

bottom of page