move collision detection logic to the engine