I need script on change level and so player was in exact location where I want him to be. Simple as that. I think I should use some sort of spawn point.
I made one and it looks like this:
var InFrontOfTheDoor = false;
var MyPlayer:GameObject;
private var drawGUI = false;
function Update ()
{
if (Input.GetKeyDown(KeyCode.E) && InFrontOfTheDoor == true)
{
Application.LoadLevel("mw_scene_02");
}
}
function OnTriggerEnter (theCollider : Collider)
{
if (theCollider.tag == "Player")
{
InFrontOfTheDoor = true;
drawGUI = true;
}
}
function OnTriggerExit (theCollider : Collider)
{
if (theCollider.tag == "Player")
{
InFrontOfTheDoor = false;
drawGUI = false;
}
}
function OnGUI ()
{
if (drawGUI == true)
{
GUI.Box (Rect (Screen.width*0.48-51, 300, 202, 22), "Press [E] to enter");
}
}
But player spawns in same coordinates as he was in previous scene. I need him to appear in precise location for example X: 1.5 ,Y: 2.5 ,Z: 10.0.
If you have any ideas about that please let me know. Thanks.