Aron’s A* Pathfinding project

A* solution can be used for Traffic & Pedestrian navigation as an alternative to the built-in A* solution.

How To Use

  1. Buy & download, import the following asset plugin:

Getting Started

  1. Create a new gameobject & add AstarPath component

  2. Add 2 Point Graph to the AstarPath component (if you are going to navigate for either traffic or pedestrian, create only 1 graph)

    _images/astar2.png
  3. Create a new gameobject & AstarPedestrianPathService for pedestrians & AstarTrafficPathService for traffic.

    _images/astar1.png
  4. The next step is to create a graph for runtime or static scene.

  5. To retrieve traffic or pedestrians, read the traffic entity selection or Pedestrian entity selection

  6. To get entity nodes on the scenes, read TrafficNodeSelector & PedestrianNodeSelector examples.

  7. After you have added service & graph, use this code:

    public class StartPathServiceExample : MonoBehaviour
    {
    // Reference to pedestrian or traffic path service
    [SerializeField] private EntityCustomPathServiceBase pathService;
    
    public void StartPath(Entity entity, Entity endNode)
    {
            pathService.SetFollowPath(entity, endNode);
    }
    }
    

Static Graph

Used for static scenes created in the Editor.

  1. Add components AstarPedestrianStaticGraph & AstarTrafficStaticGraph & assign these references to corresponding services, making sure local graph indexes are different for both graphs & matched with AstarPath (e.g. 0 index for pedestrian & 1 index for traffic).

Runtime Graph

Used for run-time generated scenes.

  1. Create a new gameobject & add a RuntimeRoadManager component & you can use Runtime Road for demo.

  2. Add components AstarPedestrianRuntimeGraphModifier & AstarTrafficRuntimeGraphModifier & assign these references to corresponding services, making sure local graph indexes are different for both graphs & matched with AstarPath (e.g. 0 index for pedestrian & 1 index for traffic).

  3. Make sure that you have assigned RuntimeRoadManager to these graphs.

  4. For a quick start follow these steps [optional]:
    1. Open a RuntimeTileRoad Demo scene.

    2. Disable built-in path services & add created path services to corresponding path selectors.

    3. Example for pedestrian:

      _images/astar3.png
    4. Do the same for traffic.