Rolling Dice

Hello Community,

can anyone give me a idea how to implement a animation where a dice roll? I have no attempt for a solution. I need a impulse.

I would be very thankful.


Something like that ?

Code is at, it is bit too complicated for simple use, because of the need to capture/transfer/emulate same behaviour between networked clients. In most basic usage, it can be probably cut down to 2 or 3 classes.

Hard part was to come up with proper models. Rest is managed by jme3 built-in physics and a bit of hackery at the end to detect which side is up.

That was a really cool video, loved the dice.

Yes, thats exactly what i searched for. I looks realy nice!!
On the first view it looks very complicated.

But thanks for your help!

There are two ways to do this. The complex one is to actually roll the dice. The simplest one is to pick a random number from 1-6, have a “dice rolling” animation and then adjust the dice so the correct result will show at the end of the animation.

1 Like