Easy Inverse Kinematics


Using Unity Version 2019.4

Inverse Kinematics (IK) refers to the use of kinematic equations to determine movements required of joints along a chain to drive an end effector to a desired position.

The best way to visualize IK is to imagine a robotic arm, with proper joints. When we animate with Forward Kinematics, we move our end effector into position by manipulating from the parent joints (shoulder, then elbow, then wrist, for example). With Inverse Kinematics, we move our end effector into position and kinematic equations figure out where all of the arm bones need to be in order to move it there.

CREDIT: Mathworks

So how can you use it in Unity, and what if you want it to play nicely with an animation?

The Problem

Your character needs to pick something up. You have the animation and prop all set up, but the character’s hand doesn’t properly reach the object no matter how precisely you try to set up the scene.

The Solution

Use Inverse Kinematics!

If you want to be extremely precise about it, get Final IK. It is, without a doubt, the top IK asset package on the Unity Asset Store.

That being said, it is pricey and has many features that you may not need. If that’s the case, Unity has it’s own IK solution that you can easily tap into. Whichever way you go, you can use the principles in this tutorial to make IK play nicely with your animations.

What you need:

  1. A character with a humanoid rig. I’ll be using my casual version of Dahlia Hart.

  2. An animation to add the IK to. I’ve downloaded a “pick up” clip from Mixamo.

  3. A prop to interact with. I’ve created a ball from a sphere primitive.

First, let’s set up the scene. Your character will need an animator controller with your pickup animation included. This tutorial is not going to cover navigation, so my animations transition from walk, to idle, to my pickup animation with no conditions. Dahlia will