I want to make rolling cube like dice that reacts on accelerometer. So accelerometer gives parameters for cube moving. I think that small physic should be used here. My question is what formulas, techniques should I use to accomplish this without any physics engine.
            Asked
            
        
        
            Active
            
        
            Viewed 3,272 times
        
    7
            
            
        - 
                    3"Dice" is already plural. One die, many dice. – DJClayworth May 25 '11 at 16:04
 - 
                    Voting to close as too broad / tool rec. – Ciro Santilli OurBigBook.com Apr 29 '16 at 09:45
 
1 Answers
8
            You will need probably to use OpenGL for that. There a good physics tutorial for OGL here
Specifically for dice, take a look at this nokia demo. It's written in cpp (source here)
On the physics side, you can take a look at this site.
Anyhow, I do not think you need real physics for the app, but just an approximation:
- I would start getting a velocity that depends on the accelerometer (plus or minus, let's say, 20%) and random angular speeds for the dice.
 - Then, find the trajectory for each and when touching a border.
 - Bounce them to one direction or another depending on the rotation at that particular moment.
 - Change the sign of the angular speed if the dice bounce back.
 - Reduce the speed about 50% each bounce, until a threshold.
 - Below that threshold, leave them in the floor and stop movement.
 
        Aleadam
        
- 40,203
 - 9
 - 86
 - 108