how I can make an object that is an instance, ignore the collision with the main player.?

Hi I tried so many things, like put a script in the instantiate object named grenade, and put this code Physics.IgnoreCollision(transform.collider,transform.Find(“Player/Main Camera/Gun”).collider); or put the code inside the Gun but never work. How Can I do, because the grenade never colision with the player, this grenade has been put in the root linke a Player, it doesn´t should collision with the player, but does should collision with other objects.

Thanks

Sometimes the projectile can think it’s colliding with the weapon - it happens when you instantiate the projectile at the weapon’s center. To avoid this, it’s better to instantiate the bullet somewhere in front of your weapon. In the weapon script, you can defined the instantiate position as:

  // define instantiation point 1.5m ahead the weapon
  var pos = transform.position+transform.forward*1.5;
  var bullet = instantiate(bulletPrefab,pos,transform.rotation);

This will create the bullet outside the weapon collider, avoiding this self-destructive behavior.
I hope it was causing your problem; if not, please explain what exactly your problem is in a comment, or editing your question. If you’re having trouble with english, explain it in spanish too - I’m a brazilian guy, so I can understand it.