Is there a rigidbody character controller 3rd person that can handel stairs (steps)?

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).

xcoins.co.uk/Misc/RigidBodyVsCC/index.html

Ok,

My solution was… using a Character Controller and a collider without a rigidbody.
(I realise this breaks my own rule about not using a Character controller).

Initally I wrote a script and attached it to the character to check for stairs using a ray cast down to the ground and one out at 45 degrees to the character front and when the front raycast distance was below the hypotenuse of that triangle (square root of (2)) it would detect a step. I also needed to include logic that if that distance was too short then it was detecting a wall or another character. I then ran into the problem of what to do when a step was detected. I ended up going with if the character had forward speed determined by the path finder meaning it should be going forward then I also applied some upward force. This sort of worked but didn’t look very pretty because the character would jump up a little bit every time it approached an obsticle.

I went back to the Character controller because it does handel steps nicely even if I have no idea how it is doing it. I added a collider and a rigidbody but this caused all kinds of isses with the object ‘freaking out’ due to weird physics conflicts. After much tweeking I realised that a fat collider on the gameobject containing the Character controller will act like a collider with a rigidbody attached even if it doesn’t have a rigidbody attached. Thus it will push other colliders out of the way (which is what I needed).

So the combination of the Character Controller and collider seems to achieve the goal of pushing objects out of the path and allows the character to step up stains that it wouldnt’ be able to with just a rigidbody and collider.

See Picture:

It still would be nice to know how the Character Contoller handles stairs/steps so, if needed, I could apply it to the rigidbody and collider.

Its a bit of an oversight that the Character Controller doesn’t have a tick box to allow collisions / physics because that would negate the use of the extra (redundant) collider. Its also worth noting that if the collider doesn’t peak out above the Character controller capsule significantly it won’t work in terms of pushing correctly.

Unity can solve this by adding those tick boxes to allow the Character Controller capsule to act like a proper push collider and a tick box for using its version of physics such as gravity / trigger / kinematic etc.

--------------------------------------------------EDIT see comment 1

Attaching colliders had the problem that only one collider could push the character controller. Thus two identical characters could not be setup in such a way that the attached collider could push the CC.

Thus, I had to change the sphere collider attached to the CC into a trigger and attach the following script to get the push behaviour I needed. Its not perfect but it works the CC will now push each other around to make way for each other during pathing.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CCpush : MonoBehaviour {

	public float pushMultiplier = 0.5f;

	public void OnTriggerStay(Collider col) {

		// Ensure this is not called on itself due to interal trigger collision with CC
		if (col.gameObject != this.gameObject) {
		
			CharacterController ctrl = col.gameObject.GetComponent (typeof(CharacterController)) as CharacterController;
			if (ctrl) {
				// move the second character in the direction of travel but at a slow speed.
				ctrl.SimpleMove (this.gameObject.transform.forward * pushMultiplier);
			}
		}
	}
}