Got 2 boxes. One of them crashes against the other. Having the Collision, how do i know which one was?
The following should do the trick:
void OnCollisionEnter(Collision collision)
{
//collision.gameObject
//Edit:
//Compare velocities to figure out which one has the higher one and therefore “initiated” the collision
}
There is also a 2D version if that’s what you need but otherwise, with the function above collision.gameObject
should be what you need! Hope this works and good luck!