- Home /
Answer by mudabbirali92 · Nov 16, 2018 at 07:51 AM
private Vector3 startPosition; bool up=true; // Use this for initialization void Start () { //maxSpeed = 3; startPosition = transform.position; } // Update is called once per frame void Update () { MoveVertical (); } void MoveVertical() { var temp=transform.position; print (up); if(up==true) { temp.y += 0.01f; transform.position=temp; if(transform.position.y>=0.39f) { up = false; } } if(up==false) { temp.y -= 0.01f; transform.position=temp; if(transform.position.y<=0.14f) { up = true; } } }
Thanks in advance..
Your answer
Follow this Question
Related Questions
Moving an object up and down 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Move FPS up/down one level in a building 1 Answer
FPS animate camera look up/down 0 Answers