Destructible objects by a projectile


I've trying to accomplish something similar to this one in Unity:

So far it's working OK, but not perfect. Setting up the blocks as rigid body, and fireing a cannon ball is quite easy too by applying an impulse force to it. However, two things are not working like I'd want it to.

  1. When the (canon)ball hits one of the objects with a big enough force, it destroys it, but the force isn't really applied to the the object next to it (i.e. if you have two horizontal planks next to each other, the first one would break, but the second one won't be affected. I also moved the HP-check to FixedUpdate method, but this doesn't appear to solve it neither. So basically the item is destroyed before it applies the force to the other objects around it.

  2. For some reason I'm not actually very happy about the damage system. My first attempt was to apply the magnitude from the collisions impactForceSum. While it seemed to be ok in the first few attempts, after some testing and playing around it doesn't seem to be that good a choice neither. Either this will cause that the ball has a good damaging effect, but the damage caused by collapsing of the structure will be to high too (i.e. stuff breaks to much) and if i increase the Health Points of the block, to less of the objects will break hence making it hard to have the player collapse it with a certain number of shots.

Any ideas if there is a better value to use for damage calculation than `(collision.impactForceSum.magnitude)` ?

This is the script I use within the blocks

using UnityEngine;
using System.Collections;

public class BlockCollisionScript : MonoBehaviour {
    public int health = 20;
    private int currentHealth;
    public float minMagnitude = 0.2f;

    private Vector3 labelPosition;

    // Use this for initialization
    void Start () {
        this.currentHealth = health;

    void OnCollisionEnter(Collision collision) {
        if(collision.impactForceSum.magnitude > minMagnitude) {
            currentHealth -= (int)(collision.impactForceSum.magnitude);
    void FixedUpdate() {
        if(currentHealth <= 0)

    void OnGUI() {
        labelPosition = Camera.main.WorldToScreenPoint(transform.position);
        GUI.Label(new Rect(labelPosition.x-20,(Screen.height - labelPosition.y)-10,40,20),string.Format("{0}/{1}",currentHealth, health));

I see you doing a couple of things.

One, you could add an explosive "force" to your objects that are destroyed.

Two, you could detect if your flying object would hit the target before it does. Then, destroy the object just before your projectile actually hits it, allowing it to pass through.

Also, you may try experimenting with the mass sizes of your projectile vs your destructible objects.