Okay I’m trying to make a level change using the default FPS controller and I want to create what is essentially a button to change level. I would like to do this by using the mouse instead of the E key. and it needs to be in a cirtain area
[2980-little+help.png|2980]
The box selected is currently a collider but I’m not sure if it can only be a trigger. at the moment I have this
var levelSelect : String;
function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.name == "FPS Level End"){
Debug.Log("Hit Door");
}
}
I know I haven’t got the Application.LoadLevel in there yet I just want to make sure I can get the debug working first.
@Khada Thanks for the help unfortunately I’m still finding problems
I’m very new to ray casting so this so I had to look up more stuff about it (One reason why this response has taken a long time)
So far the Ray script on the object looks like this
function Update () {
var up = transform.TransformDirection(Vector3.up);
var hit : RaycastHit;
Debug.DrawRay(transform.position, -up * 2, Color.green);
if(Physics.Raycast(transform.position, -up, hit, 2)){
Debug.Log("Hit");
}
}