Im making a game that when the ball hits the floor it will go to the gameover scene.
function OnTriggerEnter(collision : Collision){
if (collision.gameObject.tag == "BOOM"){
Application.LoadLevel ("2");
}
can you tell me whats wrong?
Im making a game that when the ball hits the floor it will go to the gameover scene.
function OnTriggerEnter(collision : Collision){
if (collision.gameObject.tag == "BOOM"){
Application.LoadLevel ("2");
}
can you tell me whats wrong?
OnTrigger uses collider type, not collision; swap that and try again?
i changed it a little but it won't destroy when it hits the floor. #pragma strict function OnTriggerEnter(collision : Collider){ if (collision.gameObject.tag == ("BOOM")){ Application.LoadLevel ("2"); } } Do I put the boom tag on the floor or the object that collides with the floor and where do I put the script. Also, should the floor have a box collider?
– justaskin324You have to define your TriggerEnter function in following way.
function OnTriggerEnter (other : Collider) {
if (other .gameObject.compareTag("BOOM")){
Application.LoadLevel ("2");
}
}
If you want more information then please read manual.
OnTriggerEnter
Make sure In Inspector window your Collider property isTrigger is true.
function OnTriggerEnter(collision : Collider){
if (collision.gameObject.tag == "BOOM"){
Application.LoadLevel ("2");
}
Why do all my questions always get bad votes or hate lol
– justaskin324> Why do all my questions always get bad > votes or hate lol Since I'm not the one that voted you down, I cannot be sure, but titles should always reflect the content of the questions, and they never should be in all caps. "HELP PLEASE!" is not an appropriate title. In addition, since we cannot run your code, you need to explain what your code is doing or not doing.
– robertbuCaps Lock and VERY vague titles are frowned upon here. In the menu just at the right of your screen. You'll see a nice little video tutorial that says how to ask good questions. You could use some advices that are shown in this tutorial
– Clet