Hello, I am making a game where you can’t hit the terrain otherwise you die. What kind of script do I need to do this? And I know this is hard but how would you make a check point in the game?
Thanks
Create a tag, name it “Terrain”. And set terrain object’s tag to this.
Create a script like this:
void OnCollisionEnter(Collider other) {
if (other.tag == "Terrain") {
// Game over
}
}
Put that script to the game object that must not touch the ground.
Try setting the tag of the terrain to “Terrain” and then doing this:
void OnCollisionEnter(Collision other) {
if(other.gameObject.tag == "Terrain") {
//GameOver
}
}