Question by
XALO1 · Jan 25, 2018 at 01:29 PM ·
pathfindingpathpathfollowingpath-findingpathfind
Hi, I'm working on a city traffic project My problem is that cars always At each point of the path they come to the starting point of the track when starting the game While I want to move where they are placed along the designated path this is my code
public Transform path;
private List<Transform> nodes;
private int currentnode = 0;
private void checkpoints(){
if (Vector3.Distance(transform.position, nodes[currentnode].position) < 0.9f)
{
if(currentnode == nodes.Count-1)
{
currentnode = 0;
}
else
{
currentnode++;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How can I setup a AI Bot to Pathfind around my small map? 0 Answers
File Path Confusion for Sharing an Image 0 Answers
How to make an object follow a path when necessary but move forward when holding mouse button? 0 Answers
How to achieve Aquapark.io kind of path following? 0 Answers
[Question] Get folder structure and filenames inside those folders at Runtime (Hololens), 0 Answers