3Rd person Adventure Character

Between the end of my Second Year and my Placement year, I chose to dive into Unity again to see if I could build a Player character system similar to what you'd see in modern games. This project is something I keep going in my spare time and can be viewed on Github.

https://github.com/Mike430/3rd_Person_Adventure_Character

This project was inspired to some degree by Uncharted 4's rope swinging mechanic and Ratchet & Clank's light-hearted platforming feel. The goal was to build a versatile character capable of handling many different environments. To that end, one of the first challenges I ran into involved moving across uneven floors at a constant rate and sticking to the floor when a gradient starts, ends or changes. It's worth mentioning at this point that Unity has a Player physics collider that I wanted to avoid. The reason for this is that I doubt custom game engines I may one day work with would offer such luxuries, plus I wanted to test myself.

For moving across the floor at a constant rate:
Every frame I raycast downward to get the normal of the polygon the player is currently over. I then calculate the cross product of the player character's heading(an XZ vector) and the surface's normal. After which I then calculate the new heading as the cross product of the normal and the heading tangent.

I currently have no proper solution in place for guarenteeing that the player will always be in contact with the floor, but I did experiment with one method that I ultimately had to scrap for practicality. The method involved taking the slope of the floor and the radius of the capsule collider and working out how far above the floor the capsule would have to be to not intersect. The function worked, however, it wasn't practical conceptually. If the player were on a rotating slope, before falling off they'd be shot into the air as the slope approached ninety degrees, or even if they were to touch a sharp piece of rubble.

This was one of the more exciting things to work on in the project, the rope swinging. This wasn't complicated to implement but it took some time to get it feeling good, though the rope swinging can still feel a little awkward, like when you bump into or brush against geometry while swinging.

Outside of improved movement across floors and a more refined rope swing, some of the features I'd like to implement are ledge climbing, wall jumping and gravity ramps - which are a feature of the testing level - as visible below.