Not sure how to go about getting a car to go from point A to point B. For a city road, square / tile creation nothing too complicated but how when Fred leaves home to get to work ?
Seriously no one ?
Can’t you use a target actor to set your location and make a ai move to function with a nav mesh bounds ?
So let it work out the route itself ?
Not sure if this should be a different question but how ca I tell if roads are / not connected ? I had a thought similar to A* calculating road lengths driven by my idea of North / South / East / West distance from point A to B but if the roads aren’t connected it will probably end up stuck trying to find a path.
It has been a while since I messed around with AI, but if you already know which route you’re going to take, then you can use target points, like Deftones mentioned. Having the car go to one point and then the next until it reaches the destination. A different way to do it would be to set the destination and have the car work its own route out, yes. You may want to set “Runtime Generation” to dynamic in the project settings if you’ll be placing new objects in the scene (like a city builder for instance). That way it updates the NavMesh during runtime. There are tutorials on YouTube. Look for something like “UE4 patrolling ai” or whatever you need.
As for telling if the roads are connected, I’m not sure. You mentioned that your roads are square tiles, so if they were placed in the editor, then I would assume that they are as connected any other two objects placed next to each other. Even if the tile was placed during runtime, using a collision box, I would still think that they are two separate objects with one snapped to a determined location around another… if that makes sense. In which case, if there is nothing obstructing the path, then the AI should have little to no problem reaching its destination.
I’m sure there are many, but at least one person, who is skilled enough with AI to help you with what you need. However, if you’re only trying to move a car from point A to point B, then I would use target points. In fact, now that I’m thinking about it, I would also use target points if I wanted the car to stay on the road… I don’t know much about AI, so I can’t tell you how to avoid crashes, running traffic lights, or things of that nature. I hope this helps out a little though.
I’m still stumped on this. Yes it’s a city like SimCity and others but not the version of having curvy roads just straight tiles during play which means trying to update the navmesh. I really would appreciate someone with knowledge on this. Such a common condition in games I thought there would be more info.
Edit: Sorry didn’t read properly setting up the NavMesh. Target points are a good way to go, situations of traffic handling don’t seem too hard. However really could use someone’s know how to tell if roads are connected.