Move An Object Through A Set Of Points
In order to move an objects through various points, we need a way to access those points. So for accessing them we will use an array of transforms. We will be using a Co-routine to update the object's position and to help it "Find Da Way". I'm pretty sure by the time you read this that the meme is long dead.
While going through each point by lerping through each point may seem like a viable option but it leads to results like this: This type of movement where it takes the same amount of time to cover the same distance may not be the type of movement you are looking for. First we will see how to get to this point then learn about the better way of moving stuff. private IEnumerator MoveToSeat(Transform[] path) { float t = 0; Vector2 startPostion; float distance; for (int i = 0; i < path.Length; ++i) { startPostion = transform.position; t = 0; while (t…
In order to move an objects through various points, we need a way to access those points. So for accessing them we will use an array of transforms. We will be using a Co-routine to update the object's position and to help it "Find Da Way". I'm pretty sure by the time you read this that the meme is long dead.
While going through each point by lerping through each point may seem like a viable option but it leads to results like this: This type of movement where it takes the same amount of time to cover the same distance may not be the type of movement you are looking for. First we will see how to get to this point then learn about the better way of moving stuff. private IEnumerator MoveToSeat(Transform[] path) { float t = 0; Vector2 startPostion; float distance; for (int i = 0; i < path.Length; ++i) { startPostion = transform.position; t = 0; while (t…