how do i set up an explode on impact with anygame object including terrain.
i have a tank with a bullet prefab attached to the main gun.
The gun works fine and shoots well i just want the (bullet or shell)
to explode when it hits anything.
Add a script to the bullet’s prefab, and write that inside :
function OnCollisionEnter( var col : Collision )
{
if( col.transform.tag != theTankTag )
instantiate( explosion );
}
Replace theTankTag by the tag of the tank, and add the var explosion with a prefab. Now, be aware that bullet collision might be tricky as they usually are quite fast, and so can easiliy miss a collision. Consider using raycasts if you have problems.