Hey people!
Well sincerilly i’m really newbie on this and I am trying to write a code that trigger a load.level script within in a collider of a box, using a raycast. The thing is that i don’t know if I have to write the script to the box collider or the raycast.
Specifically, I’m programin a menu with a Durovis Dive camera, so I want that the person select the next stage at sight triggerin a box colider.
So, I have the raycast in the camera here:
// Draws a line in the scene view going through a point 200 pixels
// from the lower-left corner of the screen
function Update () {
var ray : Ray = camera.ScreenPointToRay (Vector3(270,150,0));
Debug.DrawRay (ray.origin, ray.direction * 20, Color.yellow);
}
And the trigger script here:
var theLevel : String;
function OnTriggerEnter (myTrigger : Collider ) {
if(myTrigger.gameObject.name == “player”){
Application.LoadLevel (“Video Parque 360 V1”);
}
}
Please some help!