Inventory SystemSince I have been adding a lot of extra items for use on climbs, I figured that I would eventually need to gather all of these tools under an easily accessible inventory system.
I have always been a fan of keeping interactive systems inside the game world rather than in user interfaces, so I thought I would make use of the player having a belt where every item the player has unlocked would be accessible.
Testing in 3D before codingTo test the foundation of this mechanic, I started in Blender.
I set up the viewport camera to mirror the movement I wanted within the game - keeping in mind the player's horizontal rotation limits and vertical view angles.
I created a lot of the inventory item placeholders during this time as well. Testing it early was useful before I started creating any sort of scripts.
I only created as much of the upper body as the player would actually be able to see. I also created ropes to hang over your shoulder that would be visible while viewing the inventory. I created these to depict how many you have collected / have available for use.
Although the standard climbing arms are stiff with no bones or any IK, I knew the inventory belt had to interacted with using a pair of rigged arms. Another issue with using the climbing arms, was that the climbing arms in game are significantly larger than what they should be for interacting with the inventory belt.
The solution was to have a separate pair of "regular-sized" arms that are used individually when the player interacts with the belt, and so they could be hidden individually when the player is using the climbing arms.
I rigged up the same mesh as the climbing arms, scaled them down, and also added bones to the fingers so they could wrap around objects in the belt.
Creating the interactivityMaking the inventory belt viewable and interactable in game took some time, mostly working out some camera-repositioning, angling adjustments, as well as making the arms look 'right' when they hover over items and grab around them smoothly when you can view the right angle.
Under the hood, I do a lot of lerping with values to get the position and angling of the camera right. The positioning and angling of the camera to view more towards the inventory is lerped gradually depending on the player camera's vertical rotation.
With the arms/hands, the only animation actually happening is the 'reaching' and 'grabbing' on the hands which is triggered by the angle that the player currently views. The arms themselves are moved using IK targets and procedural animation.
Putting all this together took a long time, but I feel like it was worth it rather than introducing a new button for each new item you unlock.
Another important element to the system was that once you hang on to the wall with either hand, your other hand must be able to interact with every item in the inventory belt. If I didn't allow this feature, you would have to constantly switch arms to pick the item you want if they are on the other side of the belt. This would get annoying quickly, so I knew I would have to implement interacting with all items using either hand.
A bunch of time also went into tweaking the hands and IK targets enough to make them look natural enough.
The way the system works now, I can easily implement new items. All I have to do is define an angle with which they will be available to pick from, and then an empty target object which defines each different interacting hand's position and rotation when grabbing the item.
Interacting with items with each respective hand. Also a small preview of a few items that I haven't posted about yet..
Making it work on the ground also meant that each arm would had to interact with each respective side of the inventory, since the player will be standing on the ground rather than hanging onto the wall with either of the hands. When you look down, your view will be locked as long as you are looking at your inventory.
I will probably come back to polishing up some of the interacting arm's movements, but this is good enough for now. I have also got to keep a balance between how many items I add to the belt, as it can get crowded with items pretty quickly. There are only a couple more items I want to add, so it should probably be fine.
Animating legs and fixing clipping issuesAfter finishing up most of the major work on the inventory system, I decided I needed to do some animation on the legs since I had completely ignored walking animations up to this point. Movement has been mostly focused on the climbing, but a simple walking animation can really do wonders to ground the player more in the world, so I had to get them done eventually.
Good enough for now, as I can always brush up the animations later.
A small issue that came about with the inventory system, was that the items in the belt on the side of the hips would clip into the leg as the leg came around a 90 degree angle. I fixed this by angling the items according to the angle of the thighs. This is mostly noticeable when climbing, but it also adds a bit of procedural animation to the items when the player walks. (You can notice this on the thermo coffee bottle and monocular in the gif above).
There are still a few items left to add to the inventory, but for now I can focus on some more important things for the overall game. I have added some exciting things, both a while back and quite recently that I haven't posted about here yet, so look out for that in the nearest future!