Skip to main content
2 of 3
Improved formatting, spelling, punctuation and grammar; removed ending comment

##You can check the speed of both cars##

During collision, there will be two cases:

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

You need to decide which car intentionally hit the other, and obviously, OnTriggerEnter() will not help. To check for speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary###

In the first case, it's pretty simple. The car that has speed is the car that is hitting the other car.

case two - both cars are moving###

It's tricky for the second case. You can say the car with more speed intentionally hit other car; though it's not always true, it will work most of the time.