Search Unity

Flood Expand / Movement Distance

Discussion in 'Navigation' started by Mycroft, Jan 26, 2017.

  1. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    I'm doing a turn based project with the Unity NavMesh system and my units are allowed to move a certain amount each turn.

    Using the Area Costs I'm able to determine how far along a path the unit is allowed to move but I would like to be able to show the max distance the unit could move ahead of time especially taking into consideration area costs.

    On a grid/hex project this would be easy; flood outwards but with NavMeshes it's not so easy.

    Any one have thoughts or suggestions?
     
  2. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    Dont use navmesh at all, just use any flood-fill algorithm for path finding, it's the simplest path finding algorithm (I ever know) plus you will have the flood-filled grid/array you can use to show movable tiles...
     
  3. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    That's really not a great option for this project for a couple reasons

    1. A major part of the idea is to replicate the free-movement of a TableTop Minatures game
    2. There are wildly different unit sizes; Infantry all the way up to building sized Mechs. Attempting to have enough grid spaces on a normal map would put it into the 10-100k location range
    3. The terrain is modifiable and units will want to be able to be updated to the navigation and cover changes