explosion unity code example
Example: explosion physics in unity
AddExplosionForce(float explosionForce,
Vector3 explosionPosition,
float explosionRadius,
float upwardsModifier = 0.0f,
ForceMode mode = ForceMode.Force));
// Example
public float power = 10.0F;
Vector3 explosionPos = transform.position;
public float radius = 5.0F;
Rigidbody rb = GetComponent<Rigidbody>();
if (rb != null) // Check if object have component "Rigidbody"
rb.AddExplosionForce(power, explosionPos, radius, 3.0F);