Newtons laws describe the physics of a point mass. Luckily, points can never collide and cannot spin. That nice for computation. Ah, and they live in continous time!
Real-world objects have a finite volume and an orientation and therefor have inertia. For a sphere with equally distributed mass, this can be a number. Generally it is a tensor. Welcome to the world of tensor algebra.
So add at least two properties to your interface:
- inertia (Matrix3f)
- spin (Vector3f)
The critical point is to calculate the forces!! There are constant ones like
1
| G=new Vector3f(0f,-9.81f,0f) |
and easy-to calculate ones like air-resistance
1
| draw=new Vector3f(0f,0f, v*v) |
(all in their resp. coordinate systems, of course).
And there are the complex ones resulting from object interaction. As long as your objects are elastic spheres, that not a very big problem (if you can determing EXACTLY where the spheres collide) e.g. in a billiard game.
But if you have interconnected object (a swinging bridge, a skeleton) - don't do it at home. There are specialists necessary to deal with. People who know how to do the integration.
If you need to be real physical, you have to observe conservation of energy - which turns out to be very hard when doing numerics.....
Basically, there are 3 laws, .... but....
Ok, now lets talk about dissipative forces like friction, elasticity,.....