I have some Cubes (with rigidbodies) in my scene that I want to blow up. How do I get them to react/get affected by for example a bomb thrown in front of them? I found the following code that works nice, but I would like the cubes to be thrown up in the air as well.
var explosionTime = 1.0;
var explosionRadius = 3.0;
var explosionPower = 500.0;
function executeCollision()
{
var colliders : Collider[] = Physics.OverlapSphere( transform.position, explosionRadius );
for( var hit in colliders )
{
if( hit.rigidbody )
hit.rigidbody.AddExplosionForce( explosionPower, transform.position, explosionRadius );
}
}