- Home /
Generated Terrain not colliding! HALP.
Hi all, I'm sort of new to this and I'm still learning. But I have this little game where you have an infinite scrolling hilly terrain (I borrowed the scripts from another project) but I want the camera to collide with this generated terrain so I can know when to end the game. I put a plain sphere as a child of the main camera with a sphere collider on it. The terrain has a mesh collider on it and I modified the script so that it tags each instantiated plane with "Plane". The camera doesnt stop moving so I made a script but that isnt working either...am I doing something wrong?
function OnCollisionEnter(other : Collision) {
Debug.Log(other.transform.tag);
if (other.transform.tag == "Plane"){
stopIt();}
else{
Debug.Log("you hit SOMETHING");
}
}
function stopIt(){
Time.timeScale = 0;
//code to end game or whatever goes here
}
the following code doesnt even generate ANY output in the console... Please help if you can! Any assistance is greatly appreciated! Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094026im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Terrain collision problem 1 Answer
Collision Problem - Terrain collider remains flat after raising or lowering it 0 Answers
OnCollision Script... 2 Answers
Collision Help Please 1 Answer
Gameobject collision with Terrain C# 4 Answers