Changed the physics implementation significantly and added some pre
collision resolution code.