Refactor project into packages and fix issues caused by it.

Initial implementation of PhysicsObjectManager and its usage.