- Home /
Airplane crash detection help
I have a basic game where I can fly around and turn in my jet. I am using transform.translate to make it go forwards and transform.rotate to make it turn. I have randomly generated terrain (I improved someone elses script). I want to make it so that when I collide with the terrain I can call a function. Also I have a rigidbody on my plane.
Here is my crash script:
using UnityEngine;
using System.Collections;
public class Crash : MonoBehaviour {
void OnCollisionEnter(Collision collision) {
if(collision.gameObject.name == "Terrain Plane(Clone)")
{
Debug.Log ("Crash");
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613162200im_/https://answers.unity.com/themes/thub/images/avi.jpg)