Unity3D Pathfinder with Crossings
I'm trying to bring traffic on my street system. The main problem for me are the different lanes and crossings and to make it complete the different types of paths. I've tried a bit with the NavMeshes, the different types I've solved with costs, so cars prefer greater streets and ignore pavements. But there is the problem how to tell pedestrians to prefer pavements and ignore streets? And the main problem for me are crossings cause they start to switch the lanes and drive in the wrong side, turn around and so on. I'm thinking about that NavMeshes aren't the right thing but doesn't get any better idea!? My usecase is that I want to tell the police Car to drive from the police Station to a bank robbery (fixed coordinates) or the Bus to drive on a fixed route. So I want to have the Option to define multiple points and let them drive/walk to this (or the nearest) point - respecting the lanes and not do a U-Turn (not prefer this). I don't want ready to use code, just an explained idea how to go.
Without knowing how your structure is setup, I’ll pose to you some general considerations with regards to setting up your pathing.
Solving The Carmageddon Issue (people in the streets!).
Your sidewalk nodes and edges should be given a discount cost when a pedestrian AI does it’s pathing calculation. This would make sidewalks inherently ‘cheaper’ to use than streets naturally.
This Isn’t London, Mr. American. (or solving the lane issue)
To discourage U-Turns you’ll want to do the same thing as the above issue. Add an extra cost to calculating a U-Turn. If the edge/node it’s calculating will be considered a ‘U-Turn’ double it’s cost (or whatever value you deem fit). This again naturally helps to determine the best path given the current conditions.
When spearheading these types of path solving issues. Think about it from the perspective of the object in question. Your lane switching, crosswalks, etc, can all be solved using some type of variant of the solutions above. Of course this all varies depending on the amount of data you have to use to calculate the paths.
- Number of people on a sidewalk.
- Number of cars on a street.
- The speed of traffic on the current edge.
- The weighting of a particular crosswalk due to red/green light situations.
Hopefully some of these suggestions help you!
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Entertainment & General News
- Games & eSport