When detecting collisions with the Unity API, you often encounter situations where oncollision and Ontrigger are not responding, so summarize the possible causes.
void Oncollisionenter (collision other)
-Requires both Collider and Rigidbody.
-If the parties have rigidbody, then the iskinematic should not be checked .
void Ontriggerenter (Collider other):
-Need to have at least one rigidbody on both sides
-Can be checked iskinematic
-Both parties must tick the Istrigger on the collider component
The problem I encountered in development was that all two had collider, but one of them had a rigidbody, and previously checked iskinematic, which led to Oncollisionenter's inability to respond. Because the one with the rigidbody I don't want it to be affected by the rigid body physics engine, so take another strategy: Set gravity scale to 0,iskinematic unchecked.
In addition to the use of the differences, the functions of the two are also different, from the two parameters can be seen. Collision get more information than collider, in addition to collider contains information, collision can also get the coordinates of the points they contact.