How do Physics Engines work?

Physics engines are basically code libraries. When a object is created it is giving a set of values for mass, height, weight, initial velocity, center of gravity, ect, ect. Then when a reaction needs to be calculated these values are used along with the correct formula. These formulas are part of the library and are stored along with it. The reason physics engines are hard to create is because it has to write functions to caculate certain reactions and has to have functions for every single reaction that could take place. In more complex environments there could be millions of formulas needed to be able to give correct answers for all the reactions. They used as reference libraries in the coding for the particular application that needs a physics engine and the functions are called on in that code.

 

Main Page

Example code for collisions in a complicated environment