How do I get car AI to stop

Get help using Construct 2

Post » Sat Feb 20, 2016 10:39 pm

I'm using pathfinding to have cars move along roads and I'm trying to figure out how I can get cars to stop when another car is too close in front of them and start moving again when there's room. Right now I'm trying to use line of sight but I can't get it to work properly
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Sat Feb 20, 2016 11:33 pm

I've managed to get it to work by using colliders in front of the cars that detect whether or not the car has something in front of it but I feel like there's another simpler way
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Sun Feb 21, 2016 1:00 am

using line of sight set pathfinding disabled if within range and enable when out of range.
B
29
S
13
G
10
Posts: 355
Reputation: 8,317

Post » Sun Feb 21, 2016 11:22 pm

I tried that but it didn't work, it seemed to break everything like that cars wouldn't stop unless something was behind them and they wouldn't start moving again
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Mon Feb 22, 2016 1:33 am

How many cars? for each?

did you add pathfinding on out of sight find path and move along path?
B
29
S
13
G
10
Posts: 355
Reputation: 8,317

Post » Mon Feb 22, 2016 1:50 am

My code said
When car has LOS to car: Car stop
When car doesn't have LOS to car: Car move along path

that was it but for some reason it didn't work, maybe the cars were detecting themselves as well? I dunno but the way I worked it out seems to work fairly well too so for now I'll just stick with it while I work other bugs out of my game
B
22
S
8
Posts: 203
Reputation: 2,059


Return to How do I....?

Who is online

Users browsing this forum: evillair, Google [Bot], marcinkowski, unicornspitfire and 13 guests