- Home /
Question by
Kurokuma · Jul 31, 2015 at 09:37 AM ·
javascripttransform.position
Im trying to get my character to respawn after reaching a certain y axis
So I've created this java script.
#pragma strict
function Start () {
}
function Update () {
if (transform.position.y > -5);
transform.position = Vector3(-2.69, -0.479, -0.02);
}
it doesn't have any errors but after starting the game my character just floats and cant move. Its suppose to respawn the character after reaching the y axis of negative 5.
Comment
Answer by SilentSin · Jul 31, 2015 at 11:59 AM
I suspect what you want is to reset the position if the player gets below -5.
Just change the > (greater than) to a < (less than).
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
whats wrong with my save/load script? (transform.position) 1 Answer
Swap texture2D on enemy sprite once reached a certain point 1 Answer
Issues with randomly moving a cube 3 Answers
Alternative to using transform.translate and transform.position for moving objects exact values? 1 Answer