rewrite script

What I have is a script that OnCollisionEnter does and explsion but it will not work if you make the item it has to hit a trigger for another script. Other words if I take the object it is hitting and check is trigger in the mesh collider it wont work.

var explosion : GameObject;


function OnCollisionEnter(collision : Collision) {

	var contact : ContactPoint = collision.contacts[0];

	var thisExplosion : GameObject = Instantiate (explosion, contact.point + (contact.normal * 5.0) , Quaternion.identity);


	Destroy (thisExplosion, 2.0);

	

}

What im wanting is help changing this over to function OnTriggerEnter (other : Collider) if possable

All you have to do in order to change it is change the function call over to OnTriggerEnter after you enable the isTrigger of the collider in the inspector or from code. Note that you will not be able to access the ContactPoint information directly from Collider, so you’ll have to find a way to substitute that information from either accessing it through your own function, or creating a static offset that mimics the contact point.

To enable the isTrigger boolean variable from the inspector, simply click on your GameObject, go to the inspector window, click on the Collider that you have attached to your GameObject, and check the isTrigger box to activate it.