created collision function