Rotation limits

I'm making a sort of hovercraft in my game and of course want it to folow the contore of the ground it is going over. right now its just a stretched out ball using a clear capsule collider to drive it. i'd like to get it to the point where it will rock forward and back but not flip end over end. all of the examples i can find restrict rotation acording to time but i need something that limits it acording to position.

i'm using the Rigidbody constraints to keep it from moving side to side.

To follow the ground you will have to detect the normals from the piece of ground you are over and adjust your rotation accordingly. You can do this by using a raycast in the "down" (-transform.up) direction of your vehicle. To adjust your rotation look at the Quaternion.SetLookRotation function.