- Home /
After transform position player is stuck
I have a working death function and it transforms me to the position but once i am there i cant move my first person controller. Help
function Death (){
if (maxHealth == 0)
playerObject.transform.position = spawnPoint.position;
}
Answer by Unitraxx · Apr 14, 2013 at 01:31 AM
You need to reset the health, otherwise the Death() function will be called every frame again.
function Death (){
if (maxHealth == 0){
playerObject.transform.position = spawnPoint.position;
maxHealth = 100;
}
}
of course you can change the value 100 to anything you want, including a constant or a member variable.
You have to be more clear on that.. did it not solve your problem? If not, show more code.
You need to get some more brackets in there. Currently it will reset the spawn if the health is equal to zero, but it resets the health to 100 every time 'Death' is called, regardless of current health!
Good point about the brackets! @inglipX I edited my code, see if it works now.