How to destroy a certain object with another certain object?

Hello unity! I’m a 10 year old developer currently working on an RPG. What I want to know is how do I make a pickaxe destroy rock. So I have a boulder in-front of my town and firstly I need to know how to destroy it on mouse click. Secondly I need to know how to destroy it with pickaxe only. Thanks!

Welcome to Unity! Well, destructible objects usually are completely fake (as almost everything in the game world): you may have several models, one for each destruction stage, and replace the rock model as the pickaxe destroys it; another possibility is to create models of the broken rock pieces, and join them together to represent the healthy rock - throw them out one by one after each pickaxe hit (or mouse click).

In both cases, however, the main work is to create the models, which must be done in some 3D editor like Blender, 3DMax, Maya etc.

EDITED: This is an example of the first technique, where there are different models for each level of destruction. You must make a model of the healthy rock, then duplicate this model and edit the copy to show some destruction, then duplicate it and add more destruction, and so on. Save all models and import them to Unity. Create an empty game object (Rock), drag the healty model to the scene, child it to the Rock and zero its position and rotation. Drag another model to the scene, child it to the Rock and adjust its position, then repeat this for all models. Drag the script below to the Rock, then in the Inspector assign the models to the array Models - the first one must be the healthy rock. The script has prevision for a pickaxe sound: if you want to use it, add an AudioSource component to the Rock. Finally, drag the Rock to the Project view to make it a prefab.

using UnityEngine;
using System.Collections;

public class DestructibleObject : MonoBehaviour {

	public GameObject[] models; // drag the models orderly here
	public AudioClip pickaxeSound; // add a sound, if you want
	public float health = 100;
	public float damage = 8;
	private float curHealth = 0;
	void SelModel(int num){
		// disable all models first...
		foreach (GameObject model in models){
			model.renderer.enabled = false;
		// then enable only the selected model 
		models[num].renderer.enabled = true;
	void Update(){
		if (health != curHealth){ // if health changed...
			curHealth = health; // update curHealth...
			// calculate model index: 0 is 100% healthy
			int index = (int)(models.Length * (1 - (health / 100f)));

	// Click the rock to damage it:
	void OnMouseDown(){
		if (pickaxeSound){ // if pickaxe sound defined, play it
		health -= damage; // apply damage
		if (health <= 0){ // if health ended, destroy rock