FPS Tutorial Rocket Launcher

I have just finished the FPSTutorial, I realized it has been removed from the tutorial section, but it still had a lot of good information. Everything works great except my rocket launcher explosions don't do damage to the robot or the player. They damage the barrels just fine. The machine gun does damage to the robot and the player and the barrels. It's just the explosion on the rocket launcher that doesn't do damage.

I have the CharacterDamage script attatched to the robot:

var hitPoints = 100.0;
var deadReplacement : Transform;
var dieSound : AudioClip;

function ApplyDamage (damage : float) {
    // We already have less than 0 hitpoints, maybe we got killed already?
    if (hitPoints <= 0.0)

    hitPoints -= damage;
    if (hitPoints <= 0.0)

function Detonate () {
    // Destroy ourselves

    // Play a dying audio clip
    if (dieSound)
        AudioSource.PlayClipAtPoint(dieSound, transform.position);

    // Replace ourselves with the dead body
    if (deadReplacement) {
        var dead : Transform = Instantiate(deadReplacement, transform.position, transform.rotation);

        // Copy position & rotation from the old hierarchy into the dead replacement
        CopyTransformsRecurse(transform, dead);

static function CopyTransformsRecurse (src : Transform,  dst : Transform) {
    dst.position = src.position;
    dst.rotation = src.rotation;

    for (var child : Transform in dst) {
        // Match the transform with the same name
        var curSrc = src.Find(child.name);
        if (curSrc)
            CopyTransformsRecurse(curSrc, child);

Here is the Explosion script attatched to the rocket:

var explosionRadius = 5.0;
var explosionPower = 10.0;
var explosionDamage = 100.0;

var explosionTime = 1.0;

var raycastRange = 1.0;

function Start () {

    var explosionPosition = transform.position;
    var colliders : Collider[] = Physics.OverlapSphere (explosionPosition, explosionRadius);

    for (var hit in colliders) {
        if (!hit){

        if (hit.rigidbody) {
            hit.rigidbody.AddExplosionForce(explosionPower, explosionPosition, explosionRadius, 3.0);

            var closestPoint = hit.rigidbody.ClosestPointOnBounds(explosionPosition);
            var distance = Vector3.Distance(closestPoint, explosionPosition);

            // The hit points we apply fall decrease with distance from the hit point
            var hitPoints = 1.0 - Mathf.Clamp01(distance / explosionRadius);
            hitPoints *= explosionDamage;

            // Tell the rigidbody or any other script attached to the hit object 
            // how much damage is to be applied!
            hit.rigidbody.SendMessageUpwards("ApplyDamage", hitPoints, SendMessageOptions.DontRequireReceiver);

    var direction = transform.TransformDirection(Vector3.forward);
    var hit : RaycastHit;

    // Did we hit anything?
    if (Physics.Raycast (transform.position, direction, hit, raycastRange)) {
        if (hit.rigidbody)      
            hit.collider.SendMessageUpwards("ApplyDamage", explosionDamage, SendMessageOptions.DontRequireReceiver);

    // stop emitting ?
    if (particleEmitter) {
        particleEmitter.emit = true;
        yield WaitForSeconds(0.5);
        particleEmitter.emit = false;

    // destroy the explosion
    Destroy (gameObject, explosionTime);

Like I said everything works great except for the explosions damaging the robot/player. Any help would be appreciated.

i have the same problem. could you PM me the solution if you have it?

The problem is that neither the robot or the character in the tutorial have a rigidbody attached, and the script is only checking for rigidbodies to apply the damage to.

Replace rigidbody with collider wherever it occurs in that script and it should work fine (I haven't tested that one in particular but that is why it doesn't work right).

Ok, the problem here is the Explosion-Simple script is being used instead of the Explosion-Advanced script.

To fix this problem you need to change the Explosion-Simple for the Small explosion Prefab to Explosion-Advanced script.

And you can add these settings to the Explosion-Advanced script:

Explosion Radius = 6

Explosion Power = 90

Explosion Damage = 50

Explosion Timeout = 2

That will definately fix it.

KnightChatX, thanks!!! i try find the solution 3 days!!! And now I use Explosion-Advanced script instead Explosion-Simple and it works!!! Yuhuhuhuhhh!!)