Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ImpactExplosion : MonoBehaviour
- {
- //This dictates how hard of an impact the ship can take before exploading
- public int Strength;
- void OnCollisionEnter(Collision collision)
- {
- Debug.Log("Hit!");
- if (collision.relativeVelocity.magnitude > Strength)
- {
- //This destroys the gameobject the script is attached to
- Destroy(this.gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment