How can I make an NPC Car follow a path specified by an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make an NPC Car follow a path specified by an array?

I have a Vector2 array named path, where for each element the first number is the value on the x-axis and the second number is the value on the z-axis of a certain point in space. The values on y-axis can be decided by gravity. In other words, if the path array has elements (0,0), (1,0) and (1,1), the NPC car has to move from the start to finish by following that pattern. How can I code for this so that the car not only follows the specified path, but also rotates accordingly when it needs to make a turn?

9th Nov 2018, 2:12 PM
1604064_Sharif
1604064_Sharif - avatar
1 Answer
0
Well I am unsure if this is what you are after but here is a link to something that might help you out. http://www.trickyfast.com/2017/09/21/building-a-waypoint-pathing-system-in-unity/
10th Nov 2018, 1:11 AM
Mike