detect collisions in different dimensions