Make rotating cube always land facing up (2D)

Hey guys! I’m working on my very first Unity2D game and I have a question.

I want my character to rotate around freely, but always (gently) fall standing up. Can anyone please help me with this? I tried adding rigidbody2D.rotation = 0; everytime grounded = true, but it’s just way too agressive, looks too artificial.

The principle I’m looking for is pretty much just like those tricks they use on dice to always land on the same side.

Here’s how it’s right now: - YouTube

Thank you SO much for everyone who helps me out! Peace! :slight_smile:

This is the kind of thing I just have to play with to figure out. You might start with something like this every frame in FixedUpdate():

if (Mathf.Abs(rigidbody2D.angularVelocity) < someThreshold && Vector3.Dot(transform.up, Vector3.up) < someThreshold) {
      rigidbody2D.angularVelocity = Mathf.Sign(rigidbody2D.angularVelocity) * someThreshold;
}

The idea is to keep it spinning until it is facing somewhat upward, then physics should take over and allow it to land face up. ‘someThreshold’ is a variable you declare and initialize, or you can replace it with a constant.