OnCollisonEnter not recognizing collision

I am running into all sorts of issues with collision detection. I am creating a 2D platformer, and am currently working on the shoot mechanic. I am instantiating a rigidbody as instructed by the unity docs, and moving it forward using addforce. I have a wall set up to test collisions. The strange thing is is that the rigidbody projectile is stopped by the testwall, but OnCollisionEnter does not seem to recognize this. Another oddity is that when the testwall contains a box collider instead of the mesh collider I am currently using, no collision occurs and the projectile passes through it. The rigidbody projectile has iskinematic turned off, usegravity turned on(same result when off), and collision is set to continuous dynamic. The test wall has a mesh collider with istrigger turned off, and is set to static(no change when not static). I referred to the collision action matrix and added a rigid body to the test wall. This caused the projectile to pass through the wall again. I have referenced the docs and other questions extensively but have had no luck making heads or tails of it all. Here is the code:

using UnityEngine;
using System.Collections;

public class gunControl : MonoBehaviour {
 public Rigidbody projectile;
 public float spawnDistance = 3.0f;
 
 void fireProjectile(){
 Rigidbody clone;
 clone = Instantiate(projectile, transform.position*spawnDistance, transform.rotation) as Rigidbody;
 clone.AddForce(transform.right*10000);
 }
 
 void OnCollisionEnter(Collision collision) {
 Destroy(gameObject);
 }
 
 void FixedUpdate() {
 if (Input.GetButton("Fire1")) {
 transform.position = new Vector3(transform.position.x, transform.position.y, 0.0f);
 fireProjectile();
 
 }
 }
}

Tick convex on when using mesh collider.

Also, off-topic, avoid Input detection in the FixedUpdate.

A few things to try:

  1. How thick in the z-axis are your walls/objects? This seems dumb, but constraining your objects’ movement to the XY plane doesn’t really do it fully…they can still move a bit in the Z-axis and pass through each other. My solution: Make them all wayyyy thick in the Z-axis (just the collision bodies).

  2. Try reducing the speed (ie. force) of the projectile - does it register the hit then?

  3. Try using the “OnCollisionEnter” event of the other object.