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?
You 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");
}