# Rigidbody Step Offset

Is there away to replicate the character controller’s step offset functionality? At the moment even the smallest obstacle causes my rigidbody to slow drastically.

Please do NOT recommend using a character controller. My project requires the player to be able to walk on walls and the controller’s fixed rotation prevents me from using it.

Thanks.

Move your controller, doing a manual check for collisions. If it is grounded from the previous frame and collided with something with a contact point less than stepHeight distance up from your capsule’s bottom, move the capsule up so that point is where the capsule’s bottom is. You might also want to check the normal of the contacted surface to see if it’s walkable. To do that, you can use the dot product of your capsule’s transform.up and the surface’s normal, or for a more understandable equivalent use Quaternion.Angle() and use Quaternion.LookRotation() to turn the surface normal and your capsule’s transform.up into quaternions for use with the Quaternion.Angle() function.

That’s going to be a lot of work. You basically have to rebuild most of this “http://docs.unity3d.com/ScriptReference/CharacterController.html

If you want to walk on walls and use the character controller you could parent your character to an empty game object. Make sure the parent has the same local values as the object the CC is on, then rotate the parent when you walk on walls. I’m only recommending using a CC (even though you specified you didn’t want it) so you don’t have to reinvent the wheel.

There are many ways, one of’em is by using´:

OnCollisionEnter(Collision col){
foreach(ContactPoint cp in col.contacts){
if(cp.thisCollider == YourCollider){
if(cp.y < StepHeight && cp.y > yourCollider.bounds.min.y){
transform.position = Vector3.moveTowards(transform.position, cp.point, Time.deltaTime * yourSpeed);
Rigidbody.velocity = transform.up; //ensure your character will step up
}
}
}
}
//You can also add an angle so the character will only climb the steps which are in his forward direction.

It is very simple and it looks a little bit fake…but the thing is that it works perfectly.
*Use Sphere Collider and Capsule Collider instead of using only Capsule Collider.