Bullets wont collide and destroy object

I am having a problem with my code for some reason. When I shoot my bullets, the object I am shooting at will collide but will not destroy the object or cause an explosion. Can someone please help me with the code?

var speed : float = 30;
var explosion : GameObject;

function Start () {

Invoke("Destroy_Bullet", 1.0);

}

function Update () {

transform.Translate (Vector3.right * speed * Time.deltaTime);

}

function OnTriggerEnter (other : Collider) {

if (other.gameObject.tag == "shooter") {

	Instantiate (explosion, transform.position, transform.rotation);

	Destroy(gameObject);

	print("hit");
}

}

function Destroy_Bullet(){

Destroy(gameObject);

}

A couple things to check

  • Check to make sure your bullet’s collider is set to trigger mode.
  • Make sure one of the two objects has a rigidbody or however it is the doc’s suggest
  • Bullets tend to move quickly, it may be passing through the game object. Either make the bullet collider bigger, slow down the bullet, or turn on interpolate. Interpolation is probably not a good idea seeing as you will probably have a lot of bullets.
  • If you use triggers, you are going to have to manually find the real impact point to create the explosion from
  • Make sure the game object you are shooting and the bullets are in physics layers that can hit each other.
  • Make sure your tag’s make sense. You are checking if the tag is equal to shooter, I have a hunch it should be ‘not equal to’ instead

-(Edit)You are not destroying the explosion through this code. Unless you have code elsewhere that destroys the explosion, you will have to edit the line that spawns the explosion to be as follows:

Destroy(Instantiate(myExplosion,hitPosition,hitRotation),1);