object doesn't fly backwards after collision

I have a car with a rigid body running into the model, Lerpz_new, also with a rigid body. I want the car to hit Lerpz and for Lerpz to fly backwards for 3 seconds before disappearing using the following code on the car. The Force values are arbitrarily chosen:

function OnCollisionEnter(collidedObject : Collision) { 
	if (collidedObject.gameObject.tag == "Lerpz_new") { 
	    collidedObject.rigidbody.AddForce(1000, -1000, 1000);
        yield WaitForSeconds(3);
	    Destroy(collidedObject.gameObject); 
	}
}

All that happens is the car rams into Lerpz and stays there. Any clues?

Try testing whether the tags and collision stuff is set up properly. Add Debug.Log("hit"); as the first line, and Debug.Log("lerpz"); just after the if. If you don’t see HIT, it’s a collision problem. If you only see HIT, it’s a tag-checking problem. Only if you see both is it a problem with your “push” code.

Also, as per fafase’s comment, you should only have WaitForSeconds in coroutines. C# would throw an error about it in collisionEnter. Javascript probably just aborts. The timed Destroy is a cheap, legal alternative.

[in response to comments]

You can use more debugs to narrow down a long path by checking each part:

Debug.Log("CO name=" + colliderObject.transform.name);
if(collidedObject.rigidbody==null)
  Debug.Log("no collider);

Now you’ll know for sure if it’s a missing RB, or you’re hitting the leg, which has no RB, etc… .

Thanks, @fafse.

It turns out I had a character controller on Lierpz_new. I fixed it by creating a new Lerpz that doesn’t have a character controller that flies away.