Now that we have a basic idea on how we can go about using IK within Unity to structure our players hands to holding a gun, let’s take a quick look at how we can create a quick reload animation.
First, let’s get to work on building the animation of our character moving the gun up and down:
Next, we will need to add in a few more properties to manipulate within the scene:
With the asset that I am using, it has individual pieces built into the actual object. So, in this case, what we are able to do is give the illusion that we are dropping our empty magazine to the floor:
From here, we are have to adjust our hand animation back to the gun with that of the “new” clip:
After making a few adjustments to the position of the gun, along with the slide to give a more detailed approach of the reload, we can get to something like so:
Now that we have built a new animation from scratch, we just have to create our logic within Unity to know when to play this animation:
Let’s see how this is in our game:
As it stands now, it’s a little bit snappy when we finish our animation, this is because of the transition between animations is set to just 0.75 seconds. Once we adjust the value to have a longer transition period, we can see how it looks:
There we have it. We managed to build in a reload animation from our idle state. With this, I am going to move onto the next little project while looking to maybe create a minigame of some sorts with all of this.