- Home /
This question was
closed Dec 01, 2014 at 11:48 AM by
Josh Naylor for the following reason:
Duplicate Question
Question by
jjesh · Dec 01, 2014 at 11:46 AM ·
javascriptmovementrigidbodytime.deltatimefinish
How to make an object wait until it finishes moving?
I'm working in unityscript and have a section of my code where the object moves up, right, then down. However, when I run the code, it skips to moving down. I tried putting in a yield WaitForSeconds(), but it didn't work. How can I make the code wait until a movement has finished before moving to the next? This is what the section of code looks like:
rigidbody.MovePosition(rigidbody.position + Vector3(0,20,0) * Time.deltaTime);
rigidbody.MovePosition(rigidbody.position + Vector3(30,0,0) * Time.deltaTime);
rigidbody.MovePosition(rigidbody.position + Vector3(0,-20,0) * Time.deltaTime * 2);
Comment
Follow this Question
Related Questions
help fix my script 3 Answers
Rigidbody.velocity and Time.deltaTime 3 Answers
Weird Movement 1 Answer
Object stops but then eventually breaks through 1 Answer
Movement using rigidbody.velocity to apply a constant force until stop 1 Answer