Player Character
Introduction
I took the general third-person character blueprint that Unreal provides as a launching point and adapted it to fit the needs of the project. As a base inspiration and idea generation source, I used Link from the The Legend of Zelda: Twilight Princess, but all of the functionality I’ve put together on my own. What follows is a breakdown of most of my functionality, but at the bottom of the page is a series of interactive renders of the blueprint and its special functions.
Jump
I decided against having jumping at will (as BotW has and UE4 defaultly has) and instead opted to utilize an autojump function. As it currently functions, whenever my jump function is called, I launch the character vertically by a specified value utilizing the “Launch Character” node. I found this method gave me more control over just how high and how far the jump worked, as well as improved functionality as I was able to use it to make the character hop on switches.
Equipped Items
I have three general equipped items for the player. By default, I threw in two traditional tools you could find in Zelda games and came up with one of my own. I noticed that every Zelda game had a projectile weapon as one of the first items you acquired, so I included a simple first person projectile that applies “piercing” damage as the first of my “equipped” items (labelled to myself as a “bow and arrow”). The next traditional item and last defaultly available tool is a bomb, which just applies blast damage to all entities within a radius double the pick-up distance of the bomb. The third, custom item, the magic wand, will have its own page, so please check there for more information.
Action Button
The “A” button (or spacebar) is my primary action button. I utilize this button to take care of a variety of actions, from “rolling” to opening doors and treasure chests. I put together an enumerator containing all of the possible actions I could think of the player to use. From there, I hooked it up to the Player character and have a series of decision logics that dictate what the current action is. This action I then linked to an element on the HUD so that players would easily be able to see what action they have available at any given moment. Below are several of the actions that I have set up through this system.
Pick up/drop
The Pickup/Drop/Throw actions actually utilize the physics built into UE4. To pick up an object, the player character checks to make sure the object is first simulating physics and then has a mass under 100kg. If an object meets that criteria and the player’s bool says its able to pick things up, then it will attach the picked up object to a socket above the player’s head. At that point, the action switches to drop, which just simply releases the object from the socket. The object either just drops at that point or retains its velocity if the player is moving.
Climbing
Climbing mode is activated whenever a player gets close enough to a climbing wall and hits the action button. This was actually a challenge to achieve. I initially tried just simply switching forward/backward movement to vertical movement, but this wasn’t enough to allow for climbing on the wall. I then tried to just set gravity scale to 0 temporarily, but this too wasn’t enough. I ended up having to switch movement modes for the player to a mode that allowed for vertical movement, which I settled on “Flying”. Now, players are able to move horizontally and vertically across the wall perfectly, albeit with a little bit of a floatiness.
Roll
Rolling I handled very similarly to the way we handled dashing in Cyberdrome’s early prototypes. When the player is moving and presses the action button, provided that they aren’t holding any object, they dash forwards a certain distance. I handle this by getting the movement vector, multiplying it by an adjustable amount, and then using that new vector to launch the character forwards while not adding any upwards value. If I had any animation skills or access to an animator, at this point I would play a rolling animation to make it look more believable, but at the moment the functionality, which was my goal, has been achieved.
Player Blueprint
Below is an interactable render of my player blueprint as it currently is.
Please note, to view and interact with the whole blueprint, your viewing device may require you to maximize the window.