- Home /
The question is answered, right answer was accepted
Door that changes level on character collision script help?
So i really want to implement cave entrances in my first person game. However i cannot seem to figure out how to script my cave entrance object to bring me to my desired level when i walk into it. The cave mouth is just a black tunnel to walk into but there is a plane sitting in the back that i want to use as my collision point so as soon as the camera is surrounded with black you warp to the next level. seems simple but I am pretty new to coding and i can't seem to figure out how to script the plane in the back of the mouth to launch the Application.LoadLevel command upon collision with my character. If somebody can help with this they would be my best friend!!! Thank you.
Answer by Imankit · Apr 18, 2013 at 04:40 AM
If you are using a Character Controller than you have to put this code for collision detection :
void OnControllerColliderHit(ControllerColliderHit hit) {
if(hit.gameObject.name == "Door"){
// Do Something
}
}
Hey thank you so much! Haha this has been keeping me up at night!!!
Please mark it as answered and like it if you are satisfied.. It will be greatly appreciated
Follow this Question
Related Questions
reset the level? 5 Answers
Level advancment Scirpt 1 Answer
help please: Level Changing Scipt 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers