Search Unity

Find nearest object(s) of a type in Navmesh

Discussion in 'Navigation' started by vpvr, Dec 31, 2020.

  1. vpvr

    vpvr

    Joined:
    May 26, 2020
    Posts:
    1
    I'm trying to develop a small RTS game. Pathfinding with navMesh works fine, but finding the nearest reachable resources (various objects lying round) still kills my performance. I tried to store all objects in a KD-tree, but at some point the nearest resources in the KD-tree are on the other side of a river and the unit has to take a long way there. I also tried to search for the nearest elements in the KD-tree and calculate pathes to them, but this still can result in dozens of path calculations per harvester.
    Is there a easy way to solve this, would it be possible to implement a custom search algorithm on top of navMesh (e.g. Dijkstra) or should I abandon navMesh completely and try something else?