Rigidbody and AddExplosionForce

Greetings,

I am currently making some tests with AddExplosionForce. Here is a small and simple script :

var explosionForce : float;

function OnCollisionEnter (collisionInfo : Collision) {
	Debug.Log ("collider found");
	if (collisionInfo.rigidbody) {
		Debug.Log ("rigidbody found");
		collisionInfo.rigidbody.AddExplosionForce (explosionForce, transform.position);
	}
}

Instead of working, I get :

What’s wrong with him ?

addExplosionForce takes in 4 or 5 components - you only gave it 2

I thought the default value of radius would be zero. I gave him explicitly a 0, it stop yelling me this error. Well…thanx you.

But now, I am facing a little problem :

Uploaded with ImageShack.us

Two objects : A Cube made by Unity with a Box Collider and a Rigidbody.
A Laser, as shown in the picture (Line Renderer for visual, Box Collider for OnCollisionEnter).

As shown, the laser enters the cube but won’t trigger the previous code (and send the cube flying away).

Any idea ?

How are you moving the laser? If you’ve got the line renderer and the box collider on a single game object, make sure the line renderer has the world space option switched off, otherwise the box might not move in sync with the line.

The laser has a line renderer, with “Use World Space” off. It also has a box collider. I use a transform.Rotate in order to make it move around his Y axis.

The cube has a rigidbody (with is kinematic off) and a box collider.

Look like I needed to give the laser a rigidbody (Is kinematic do not matter but I set it off so it would not fall). But why a rigidbody was required ?