mchrbn/unity-traffic-simulation

Some cars don't follow waypoints

Closed this issue · 5 comments

Why would that happen, how can i fix it?

Bandicam.2021-11-15.17-30-13-268-1.mp4

Apparently they are trying to go to Segment-0, but why?

https://streamable.com/teiuwz

It could be because of the starting position of your cars - at the start, the system tries to get the closest front waypoint from the car in order to automatically define where the car has to go. But if the waypoint is very far away, it could pick the wrong one.

I can see from your video that you have very long straight segments without any waypoints in between, maybe that could be the issue?

It seems that some cars are driving properly, could you check if these ones are positioned close to a waypoint at the start? And if the one who are driving wrong seem very far away from a waypoint?

Yeah it's completely related to the starting position i think.

If you look at the areas where the problem occurs most, they are bends, where most of the waypoints are located.

And, opposite to what you said, these happen when the cars are too close to waypoints, not because they are too far away.
When I move the broken cars away from any waypoint they start driving normally.

Also I tested if it's related to closest waypoint being in front/back of the car too, and no it isn't.

https://streamable.com/tbgapm

Mhh did you try to change the value of "Segment Detection Threshold" on the "Traffic System" gameobject? If not, try to increase the threshold a bit.

If this still doesn't work, you can upload your project somewhere so I can have a look.

I increased it from "0.1" to "2" and now everything seems to be working properly, thanks