OnTriggerEnter - Explosions that appear on the surface of hit object

Hello,

I have some fireballs that need to explode on contact with an object. However sometimes they seem to explode a bit behind the surface of the object.

Is there a way to specify the position of the explosion to be at the outside of the object?

Thanks!!

function OnTriggerEnter(other : Collider){
	if (other.gameObject.layer != gameObject.layer)
	{
		var newExplode	= Instantiate(explosionPrefab, transform.position, Quaternion.identity);
		Destroy(gameObject);
	}
}

You can get the closest point on the bound of the collider of object to get a point on the surface of your object and then instantiate your explosion prefab at that point.

Read: Collider.ClosestPointOnBounds