I’ve spent most of my day trying to build a 3rd person character controller. It’s come together rather well, but I can’t seem to get beyond this block.
Expected Behavior:
User walks forward into an asset tagged “Wall” (the wall asset with box colliders framing various sections of the wall)
User begins to climb the wall at a slower speed than average movement.
Actual Behavior:
User walks into wall. User climbs over base of the wall and begins to scale first section (stone). User gets stuck under box collider representing the ledge 1/3 up the wall. (between stone and large flat section)
Environment:
Walls contain a base ledge, a ledge roughly 1/3 the way up the wall, a long flat surface, and another ledge on top. The ledges are actually more like baseboards and ceiling boards. I need to be able to climb over them as I climb up the wall.
You can view the code here:
https://codeshare.io/G64Nym
There is an image attached of the wall and it’s colliders. The little white capsule in the bottom right is the character prototype. It has a capsule collider around it that fits perfectly around the capsule itself.
What I need:
- The character must be able to climb the wall, as well as run along the top of the ledges.
- A better solution to climbing up the wall than translate (vector3.up) as it is causing problems with other functions.
- To be able to jump off and away from the wall when the player hits space.
- To be able to climb slowly as the distance the player will be able to climb will be controlled by stamina.
What I’ve Tried:
- Adding a trigger quad that pushes the player away from the wall OnTriggerEnter. It was working before I switched from test movement (always forward) to manual control (hold w).
- A sloped quad/plane. These seemed to work at just the right angle, but if I add more slopes or 3d assets to the wall, it fails. e.g., just the one slope will get me over the middle ledge, but if I add another to get me over the top ledge, the middle slope fails. I’m not sure why that’s happening.
- I’ve looked into getting the location of the outer edge of the box collider on the middle ledge and moving the character to that transform.position, but it appears that that’s not an easy task to accomplish, if possible at all.
If you can point me towards a better solution for this, please do. I’ve scoured the internet today trying to find a solution or even a hint of how to do this, and I can’t seem to find anything that fits just what I need.
Is it time to rewrite this code in a more complex way, or can I save it?
