2D Dice Shaker

Hi guys,

I’m currently working on a simple dice shaker game. Player can shake their mobile device to let the dice to roll and bounce.

My game will be something looks like this.
https://play.google.com/store/apps/details?id=com.pallosalama.dice.free&hl=en

but mine 1 will be much simpler because its only 2d.

Now, I’m only able to do rolling animation with random sprites, but I’m stucked on the physics part on how to shake to bounce the dice with android accelerometer.

I do hope you guys could provide me some sample codes on how to do it.

Thanks

Accessing the accelerometer of the device, is done with Input.Acceleration.

From there you can simply multiply your objects velocity/position by the accelerometer values, or calculate an intensity threshold that, once reached by the user, applies a random amount of force to the dice.