Hi there! I'm trying to make my player respawn at a fixed spawnpoint. I want to have different spawnpoints along my level... here is my question: how can i pick up the cordinates of a taged gameobject? thanks
here is my script:
var spawnp=0;
function dead()
{
if(spawnp == 0)
{
transform.position.x = 0;
transform.position.y = 12;
transform.position.z = -9;
transform.rotation.y = 0;
}
if(spawnp == 1)
{
transform.position.x = 0;
transform.position.y = 26.0515;
transform.position.z = 121.4297;
transform.rotation.y = 0;
}
}
Healthcontrol.LIVES -=1;
}
thanks, but it didn't work: Assets/scripts/respawnPlayer.js(68,49): BCE0034: Expressions in statements must only be executed for their side-effects.
– allesisdawhat i meant was, to put your info in that order, like if(spawnp ==0){GameObject.Find("YourTransformToMove").Transform.Position = new Vector3(0,12,-9);} if(spawnp ==1){GameObject.Find("YourTransformToMove").Transform.Position = new Vector3(0,26.0515,121.4297);} note that the name "YourTransformToMove" should be replaced for the name of the transform you want to change its position like cube1, hero, mainchar or the name you used, i thought the answer i gave, was intuitive, my bad.
– poncho