Ideas for physics for cubes

I want to make a cube that looks like a cube that responds to an accelerometer. Thus, the accelerometer provides parameters for moving the cube. I think you need to use little physics here. My question is which formulas, methods should be used to achieve this without any physical engine.

+8
android algorithm graphics
source share
1 answer

You will need to use OpenGL for this. There's a good physics tutorial for OGL here

In particular, for the cubes, see the demo version of nokia . It is written in cpp ( source here )

From the physical side, you can take a look at this site .

Anyway, I don’t think you need real physics for the application, but just an approximation:

  • I would start to get speed, which depends on the accelerometer (plus or minus, say, 20%) and random angular speeds for cubes.
  • Then find the path for each and when touching the border.
  • Discard them in one direction or another, depending on the rotation at that particular moment.
  • Change the angular speed sign if the bones come back.
  • Reduce the speed by about 50% from each bounce to the threshold.
  • Below this threshold, leave them in the floor and stop moving.
+7
source share

All Articles