Made a function of the collision