I have some self-righting code in my game here: http://www.tosos.com/ShooterMark2.html so you can see how it works (just start single player wasd to move and mouse to shoot. Blow up one of the asteroids).
Here's the code:
var restore : Vector3;
function FixedUpdate () {
if (rigidbody.position.y != 0) {
rigidbody.AddForce (0, rigidbody.position.y * -restore.y, 0);
}
zoff = transform.localRotation * Vector3(1, 0, 0);
xoff = transform.localRotation * Vector3(0, 0, 1);
rigidbody.AddRelativeTorque(-xoff.y * restore.x, 0, zoff.y * restore.z);
}
That "AddForce" is what keeps the ship and asteroids on the 2d y=0 plane. Basically it works like a spring measuring how far the normal vectors are off from normal and then has the spring pull it back in.
Depending on when you look at this the effect might be less pronounced. I do this by increasing the angular drag and also increasing the "restore" values. At the more damped level it's restore = (500, ?, 1000) and drag = 5 (at the lower level I think it was drag = .2 and restore = (75, ?, 75)