How do I calculate the force affecting a rigidbody?

Hi all,

I have an explosion force (Rigidbody.AddExplosionForce) that is affecting other rigid bodies (npcs, crates, tea cup, rubber ducky, etc) and I would like to detect how much force is being applied during collision with the explosive force. In the manual it says the explosive force function drops of linearly over distance to rigidbody; I read another post here to try and determine the acceleration (change in velocity) and then you use the F=ma but getting the acceleration from the change in velocity seems a little "clunky." I thought maybe there would be something in "Collision" information that would say here's the force vector or even a magnitude.

Thanks in advance, you guys rock!

There's probably no neat way to get the force applied. It would be nice if the function did actually return the result of its calculation, or if it used another publicly available counterpart for the calculation only.

Anyway, I think you're best off implementing your own function for this. It's not very complex, and you can make it more complex/interesting if you want by looking at the colliders and see how much they "face" the explosion, which should determine how much the body is affected.

This is what I came up with.
A little clumsy but it works.
The one thing I don’t understand is, if explosionRadius=5, why does the explosion affect objects up to 30 units away???

var explosionRadius : float = 5.0; //The radius of our collision.
var explosionPower : float = 350.0; //The amount of power the explosion shall have. 350

var colliders : Collider[] = Physics.OverlapSphere (transform.position, explosionRadius); //Sets a collider sphere variable.

//For each new thing the hit var, that we define in the function, that the explosionRadius collides with.
for (var hit in colliders)
	//If the thing we hit is a rigidbody.
	if (hit.rigidbody)  
			var d=Vector3.Distance(transform.position,hit.rigidbody.position);
			var radius=30;
			var f=explosionPower*(radius-d)/radius;
			if(d>radius) f=0;
			print("hit enemy tank, power="+f+" distance="+d+" pow="+(Mathf.Pow(f,2)/100000));
				print("ps is null");
		hit.rigidbody.AddExplosionForce(explosionPower, transform.position, explosionRadius); //Add an explosion force that affects all rigidbody's.