OnCollisionEnter problem (RocketJump script)

I am trying to create a rocketjump script as in TeamFortress2,and it works but the explosion take place even if the rocket hits the Player which I dont want,I want if the rocket hits the ground and the player is in the range the the player receives the knockback.I want this because when I fall from the sky and I shoot below me I still get knockback from the player falling on the rocket,I dont want this collision.What should I do?

private void OnCollisionEnter(Collision collision)
{
    explosionOrigin = transform.position;
    // Wait one frame before starting, to ensure all objects are affected

    Collider[] objectsInRange = Physics.OverlapSphere(explosionOrigin, explosionRadius);

    foreach (Collider collision1 in objectsInRange)
    {
        foreach (Collider hit in objectsInRange)
        {
            Player player = collision1.GetComponent<Player>();
            if (player != null)
            {
                // Apply knockback force to player if they are in explosion radius
                player.Knockback(player.transform.position - explosionOrigin, explosionForce);
                
                
            }
        }
        Destroy(rocket);
    }
    if (collision.gameObject.tag == "groundMask")
    {
        Destroy(rocket);
    }
  

}

}

If you don’t want your rocket to collide your player I recommend removing collisions between their two object layers. You could put the player on a “Player” layer and the rocket on a “Rocket” layer and then in Edit → Project Settings → Physics you can turn off the collisions between those layers in the collision matrix