Here is a whiteboxed 3D mechanic prototype with third-person controls. This began as an assignment for school where we were to implement a primary mechanic and a secondary mechanic. After the course ended, I decided to revisit it and see what I could do without being confined by time.
For movement, character can W/Move Forward, Mouse Cursor/Turn, Shift/Sprint while moving and Space/Jump. Primary mechanic is Left Click/Shoot Arrow. Secondary mechanic is the player can temporarily run up any blue walled surface by approaching it.
I went with these two mechanics because I first found the model on Mixamo.com and thought I could do something with it. Using her with her bow and arrow, as well as finding those running/sprinting animations made me go down an adventurer route, so many of the decisions made were to create a satisfying exploration feel for the player.
1. Arrow Shooting
The shooting arrow mechanic is straightforward; the player clicks the left mouse button and an arrow is spawned from an invisible spawner in front of the player object, which then flies forward until it collides with another object in which all of its physics is turned off.
The only objects set to react specifically on collision with arrows are the floating targets you see. Here, more code is implemented to actually parent the arrow onto the target as it falls, creating the illusion that the arrow is stuck to it like it would be in reality.
2. Wall Running
The wall-running mechanic hinges on two empty colliders set as triggers, one on the player’s right hand side and one on the left hand side. The moment the player’s normal collider runs into a jumpable surface, several things happen.
Depending on what angle the player collided with the surface at, each trigger will flag as “good to jump” if at the moment the player collides with the jumpable surface, that trigger is colliding with it as well. If the left-sided trigger is flagged as good to jump but the right-sided trigger isn’t, then the player will run up the wall from the left hand side, and vice versa. However, if the player collides with the jumpable surface at an angle where both triggers are flagged as good to jump, then the player will run up the wall from the front.
Code repository here.
- Build simple environment w/ royalty-free assets
- Implement player movement
- Implement arrow shooting ability
- Implement wall-running ability
- Set up animations
- Troubleshoot problems as they arose
- Visual Studio