So I’m making a game where if you fall off the map the invisible cuboid below it will send you to spawn upon collision with it.
var player : GameObject;
function OnStart ()
{
player = GameObject.Find("Player");
}
function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.name == "Player")
{
player.position = Vector3(0,4,0);
}
}
Is what I have so far. How ever this does not do anything. The spawn coords are 0, 4, 0.