I don't want to explode my plane. I don't wanna die!

Hi folks, i got a problem making my plane explode on any collisions.

I did put the code below, but it isn’t working…

var projectile : Transform;

function Update () {
	
	if (Input.GetButtonDown("Jump")) {
		Instantiate(projectile, transform.position, transform.rotation);
		Physics.IgnoreCollision(projectile.collider, transform.root.collider);
	}
	
}

Well console said: Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision.

But both have colliders…and i don’t know what it means when it sais ‘activated’… :stuck_out_tongue:

Can you help me to solve my problem?
Thank you !! :slight_smile:

You’re trying to ignore a collision with the collider of the prefab itself, which doesn’t exist in the scene. It would have to be more like

		var projectileClone = Instantiate(projectile, transform.position, transform.rotation);
		Physics.IgnoreCollision(projectileClone.collider, transform.root.collider);

–Eric

Ooh, it is exploding my plane again…not working… :stuck_out_tongue:

In that case, trasform.root.collider isn’t correct.

–Eric

But this script is in the Player object…
i dont know what would be wrong… :?

EDIT: Yes my player had two collider components. So i removed one of them and it is working… :smile:

THANKS!