I need a rigidbody script with a capsule collider attached that is capable of steping up medium sized stairs (for 3rd person characters driven by AI pathfinding).
First (PLEASE READ THIS BIT),
1.)
I DO NOT want to use the character component provided by unity to handle steps. (I’ve read many, many posts with people asking this exact question and getting that back as a response.) I’ll explain why.
2.)
I DO NOT want to change my level so that all the steps/stair created through box colliders are replaced with slopes to give the illusion of walking up stairs. I’ll explain why.
Why.)
The Unity Character Controller does not use physics, my game does use physics. Each character of which there are many walks around on a nav mesh and their behaviour route and interactions are goverened by RAIN pathfinding AI. Thus each ‘character’ must have a rigid body and collider attached to push other characters around and interact with scene objects with rigidbodies attached and trigger animations. The character movement is root motion controlled by RAIN AI speed and turn direction parameters.
The level has lots of small steps many of which are procedurally generated. These include small steps and walls. It is not feasible to add slope colliders to these and doing so procedurally could cause characters to get stuck on slopes of high incline.
What I need:
I need a simple Rigidbody character controller that has a step height field on it. That allows me to control the size of step that my 3rd person characters will be able to walk up. At the moment they can currently walk up very small steps just by virtue of having a round bottom on the capsule collider that can coast over small steps. However when they get to slightly bigger steps they can get stuck trying to go up a legitimate navigation mesh path.
Adding a character controller lets them go up these type of steps/stairs and I have tested adding them to each character BUT it does not work correctly with the physics system they lost the ability to push each other around correct/ or objects and this also causes interaction problems. So I know there is a way to get them to go up these types of steps using a script. What I need is a character controller that uses phyisics (the unity character controller does not and adding a rigid body to it can cause it to behave incorrectly).
Please help; link me to a decent rigidbody that has a float field for step size. I’ve searched this for days and I’ll I get are circular threads that end up suggesting unity CC or fake slopes. I think I’m going mad.
---- EDIT— I made an example to demo the problem:
WebGL hosted here (will not stay up forever).