Finalized collision engine for rectangular and linear hitboxes.