Dice Not Behaving to Normal Physics

I have created 2 cubes to use as dice.

I drop them from a height with a random rotation.

When they hit the plane collider that I have created as the surface for the dice to fall on to, they will roll around a little and then finally come to a stop. This is when I detect what side is facing up.

The problem is that the dice are not behaving like real dice would.

For example sometimes the dice will land on an edge and the very slowly fall to a face.

Sometimes they will just stay on the edge.

Sometimes they will fall almost all the way to a flat side, but still not quite be all the way down so I can’t detect that they have achieved a side.

The physics settings for the game are all default so the gravity setting is -9.81.

The dice have a rigid body on them with these values:

mass: 1
drag: 0
angular drag: 0
use gravity checked
is kinematic not checked
interpolate: none
collision detect: discrete

I think those are the defaults.

I have tried making the mass very large and that did not change how they behaved.

If you throw real dice and they are not spinning around they fall to a side almost instantly. This is the behavior that I would like.

Can someone tell me how to make that happen?

This is an older post, but in case anyone else wants info. Step 1 is apply a physical material to the collider. This allows you to tweak friction and bouncyness. You can also add one to the rolling surface, which makes a big difference, and the phys material can be set for those values to interact.

I also did a script for nudging and kicking stuck die. if it couldn’t detect the side, it would return a zero… and on the update I’d nudge it:

if(side == 0) {
                if(attemptCounter < 5) {
                    Nudge();
                } else {
                    Roll();
                }
            } else {
etc..

public void Roll() {
    isRolling = true;
    awaitingResult = true;
    rb.AddForce(Random.onUnitSphere * forceAmount, forceMode);
    rb.AddTorque(Random.onUnitSphere * torqueAmount, forceMode);
    attemptCounter++;
}
public void Nudge() {
    isRolling = true;
    awaitingResult = true;
    rb.AddForce(Random.onUnitSphere * 0.2f, forceMode);
    rb.AddTorque(Random.onUnitSphere * 0.2f, forceMode);
    attemptCounter++;
}

I ended up doing similar things, but still feel like it doesn’t match real world dice very well.

I hit this issue today and got something I’m pretty happy with after futzing with the values for a bit. Here is what I ended up with

Dice Box (the rolling area) is a 10x10x10 area of Plane objects
Dice is a slightly curved-at-the-edges 3d Cube mesh that is 1x1x1, though I tried with a classic out-of-the-box Cube shape and it was also fine.
Rigidbody on the Dice. Default values [Mass: 1, Drag: 0, Angular Drag: 0.05, Use Gravity: True]

2 Physics Materials

  • TablePhysics (I only put this on the floor, I did not put it on the walls)

    • Dynamic Friction: 0.2
      Static Friction: 0.2
      Bounciness: 0.4
      Friction Combine: Average
      Bounce Combine: Average
  • DicePhysics

    • Dynamic Friction: 0.1
      Static Friction: 0.1
      Bounciness: 0.1
      Friction Combine: Minimum
      Bounce Combine: Average

Then in Unity → Project Settings → Physics → Gravity → (0, -60, 0)

In my Dice Rolling Script, I have a roll method like this and landed on the values below. Note the maxAngularVelocity - your dice will only spin so fast without increasing it. The default maxAngularVelocity on my version of Unity was 7.

    [SerializeField] float kickStrength; // 500
[SerializeField] float popStrength; // 1300
[SerializeField] float maxAngularVelocity; // 14
Rigidbody rb;

    void Awake () {
        rb = GetComponent<Rigidbody> ();
        rb.maxAngularVelocity = maxAngularVelocity;
    }

    public void PopKick() {
        rb.AddTorque (Random.Range (0, kickStrength), Random.Range (0, kickStrength), Random.Range (0, kickStrength));
        rb.AddForce (Vector3.up * popStrength);
    }

The idea behind the dice having low friction is that they should slide off each other and land gracefully for the most part. This really helped with Dice getting stuck leaning up against one another / the walls of the dice box. The dice do slide a little comically on the table but this feels workable. You’ll still probably need some kicker coroutine for if dice get stuck without landing gracefully but from a gameplay perspective its pretty rare that it happens.