- Home /
Environmental Death script
I am trying to use this script that is supposed to re set my character controller to the spawn point when it touches a plane but yet this script is having compiling errors when i try to put it on the controller.
specifically these lines
" function LateUpdate(); { if(dead)
{
transform.position = Vector3(0,0,0);"
This is the script
private var dead = false;
function OnControllerColliderHit(hit : ControllerColliderHit) { if(hit.gameObject.tag == "Floor") { dead = true; }
function LateUpdate() { if(dead) { transform.position = Vector3(1510.397,597.7795,1255.543); gameObject.Find("Main Camera").transform.position = Vector3(1510.397,597.7795,1255.543); dead = false; } }
any help with this out be greatly appreciated
Answer by HazeTI · Aug 20, 2012 at 04:22 PM
Firstly, it's hard to read the code in your question because it's not formatted correctly, you might want to review your question before posting it.
Now, regarding your question, you've missed out the closing } in your OnControllerColliderHit, that's what is causing the compile error.
i.e.
private var dead = false;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Floor")
{
dead = true;
}
} <--- this is what you missed out
function LateUpdate()
{
if(dead)
{
transform.position = Vector3(1510.397,597.7795,1255.543);
gameObject.Find("Main Camera").transform.position = Vector3(1510.397,597.7795,1255.543); dead = false;
}
}
Firstly that you so much for responding, I'll try adding the closing tag yes sorry i really should have reviewed the question first.
Please don't post comments as answers. Post comments by clicking the [add new comment] button, a window then open for you to type in. Answer fields are for answers only, as this is a knowledge base.
Your answer
Follow this Question
Related Questions
death script remains ineffective 1 Answer
How can I lose health when my enemy collides with the player? 1 Answer
Death upon health = 0 2 Answers
Fall Death 1 Answer
Make a script look for something an an other script 1 Answer