using UnityEngine;
using System.Collections;

public class DestroyRigidbody : MonoBehaviour {

	private bool rigidbodyActive = true;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(rigidbodyActive && this.rigidbody.IsSleeping()){
			Destroy (rigidbody);
			rigidbodyActive=false;
			gameObject.collider.isTrigger=true;
			if(animation!=null)
				animation.Play();
		}
	}
}
