IK System in Unity

Jordan Evans
4 min readNov 5, 2021

Now let’s take a look at how we can use the rigging system within Unity to make it appear as if our player is holding onto a gun. To start, we will want to add in a character model along with an animation from Mixamo. Once we have what we like, let’s get to work on attaching them together:

When we are working with the character model, along with our mixamo animation, we will want to make sure that we adjust our animation type to Humanoid so that it works properly. From here, we can take a look to see if it works within our game:

As we can see, we have our character model in the idle pos, but it’s a little bit zoomed in at the moment. To fix this, we can adjust the clipping planes:

What we will do is with the gun prefab we added in, we are going to adjust our clipping plane, along with the position of the camera so that we just have the vision of the gun in our game view:

Now we will want to go into our package manager and add in the Animation Rigging:

From here, we can add in our rig builder to the character model, and add in rigs to an empty game object that we will adjust to control our arm movements:

With this IK object set up for rigging, we can create objects for the hands and the hints:

IK systems are Inverse Kinematics and they are a method of animation that reverses the direction of the chain manipulation. What it does is allows us, in this case, work with just the arms of our player when we move around. As for the hint, those are essentially the joints that we rotate around:

What we will want to do now is add in a 2 bone IK constraint to the 4 objects we created, and add in the pieces that we want it to adjust, along with the source objects to work with:

From here, we can just check to see how warped our characters arms get when we check in in the game:

Upon a few adjustments we can have our model look a little more natural, but still not there:

What we will want to do next is create some objects to follow on our game so that our hands have something to attach to. We could set it up so that the hands adjust the gun, but when working with different styles of guns, it is usually easier to just work as if the gun is making the movements, not the hands:

One setting we will want to be sure is turned on within our arms is to have it update when offscreen. This will allow us to see our hands within the game:

Now that our model looks more like he’s holding a gun, we can look at making the fine touches on it:

Now that we have the visual of holding the gun, we got a couple small things to add in to give a smoother feel:

We will attach this script to our USP_pos along with the L/R hand objects we made:

What this will do is provide a smoother looking movement when we move the mouse around and our hands wont have to play catch up to every movement we make:

Now that we have rigged our character to holding a gun, we will take a quick look next time into how we can further use this to create a custom reload animation.