Split collision function into parts so Components can use it as well.