Return to site

Online physics games newtons laws

broken image
broken image
broken image

#4: Collision detection is pretty tricky, as it doesn't fit neatly in an object class. It should be able to resolve the interaction between forces itself without outside interference. The basic object class should probably have a list of all of the local forces acting on it. Some Force classes should be global, thus allowing for things like gravity. #3: After that, you need to have a Force class.

broken image

You should have a base object class (with lots of virtual functions) that holds simple physics constants (position, velocity, acceleration, mass, etc). #2: You should have a PhysicalUniverse class that contains all of the physics objects. In general, don't take a coding practice/standards lesson from Allegro. It is prone to simple errors that even the GCC C++ compiler could catch in equivalent C++ code. It is never pretty, elegant, nice to implement, or simple to use. If I ever see any half-assed hacked-on OOP into C, it'll be too soon. Let me disagree with, pretty much, everything Bob has laid down.

broken image