I decided to experiment a bit with my existing character controller (bullet physics). The way it was prior it was a capsule sliding across the ground which I did a ton of tweaks to to implement things like jumping, crouching, stepping, etc. However for anything more than flat surfaces or ramps sliding a capsule rigid body around on the ground doesn't really cut it (gliding when falling issue since only gravity pulls you down, random stutters when colliding with certain geometry edges, etc).
So after a bit of research and some pondering, I decided to attempt an implementation where a rigid body capsule rides on top of a ray. To my surprise, this works out much better than I was thinking it would. I know there will be a ton of edge cases I'll need to work out, but for just overwriting the capsule's Y origin component with the position of the ray cast hit plus an offset, seems to work pretty well.
With that being said, I was running around my test scene and noticed that I was getting stuck when walking under ramps:
This would appear to be happening because I'm shoving the capsule up every tick even if the amount that I'm shoving it puts it through existing geometry, then bullet attempts to resolve this by pushing it back out, but the amount I'm shoving it back up on the next tick overpowers the amount that bullet is attempting to correct it…then we eventually wind up stuck inside the ramp object.
I'm currently trying to think of a creative way to handle this situation, and wanted to post it to see if any one else had any ideas, or if maybe there's a simple solution that I'm just over thinking?
float distanceBetweenCapsuleOriginAndCapsuleBottom = this->realCapsuleHeight / 2.0f;
float offset = this->getFootYPos() + this->stepHeight;
float newCapsuleOriginY = distanceBetweenCapsuleOriginAndCapsuleBottom + offset;
this->capsuleActor->getRigidBody()->getWorldTransform().getOrigin().setY(newCapsuleOriginY);
// where this->getFootYPos() returns raycast hit Y value