Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Pathfinding with public transport options (boat/train etc)?

Discussion in 'General Discussion' started by MxHarr, Aug 14, 2019.

  1. MxHarr


    May 28, 2019
    Goal: Agent at A reaches destination at B in the shortest route (which could involve transport)

    Problem: If I just tell the agent using navmesh to go to B it will follow the dotted line which is very long and slow.

    What I want: I'd like the agent to realise taking the boat is the fastest route and take the boat.

    Steps needed;

    1. A has destination to B

    2. A finds taking the boat is the fastest

    3. A goes to the boat station

    4. A waits in a queue

    5. Boat arrives and let's on X amount of people where X is the number of free seats on the boat.

    6. A walks onto the boat to their free assigned seat (How to get an agent to walk on a boat because a boat isn't static?)

    7. A rides the boat across the water

    8. A gets off the boat at the next station

    9. A walks to B to complete their journey
    Any help/suggestions on how to tackle this problem or at least some of the steps?

    Attached image to outline my problem pathfindingboattransport.jpg
  2. GameDevCouple


    Oct 5, 2013
    You can define area costs in the navmesh settings, so you can basically say the boat path is cheaper and they will path using that instead.

    Note: You cant have a moving navmesh so you will need to write your own logic for transfering from the navmesh to boat, moving with the boat, and back to navmesh again. Shouldnt be too difficult and there are a number of tutorials you can find on the internet with very little searching for this sort of thing.