Implemented the core of the physics engine