Search Unity

Navigation in a Randomly Generated Environment

Discussion in 'Navigation' started by shadowmasterx99, Feb 9, 2015.

  1. shadowmasterx99

    shadowmasterx99

    Joined:
    Feb 8, 2015
    Posts:
    5
    Well, I may have bit off more than I could chew.

    I'm making a game with a randomly-generated environment (prefab rooms placed randomly in a grid-like arrangement) and I want an enemy to be able to chase the player. However, a navmesh won't work because the environment is generated when the game is started and a navmesh would need to be baked before. Is there a way to navigate the enemy in this kind of environment?
     
  2. Ap0C552

    Ap0C552

    Joined:
    Feb 7, 2015
    Posts:
    43
    I am just learning Unity and pathfinding myself. But I can give some advice simply because I have been neck deep in research.

    Some Solutions

    1. The pro version of Unity offers navmesh carving, which does exactly what you would need

    2. Not tested yet, but I think a pretty inadequate solution might be to make added prefabs obstacles stationary navmeshagents. So the agent to agent avoidance would make agents ovoid these obstacles. It is inadequate though because the path will be calculated without taking into account other agents, and adjustments will be made once they hit the other agents. So pretty undesirable behavior.

    3. Or you check out this, which is what I am going to do when I get home :p It seems to be highly recommended, and used in the community.

    http://arongranberg.com/astar/