Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Astar Node problem in maze project

Discussion in 'Scripting' started by Bolt, May 4, 2016.

  1. Bolt

    Bolt

    Joined:
    Dec 15, 2012
    Posts:
    296
    I wanted some advice from you. I realized the script to generate random mazes in runtime. I wanted to apply now pathfind A star. I'm working with nodes and each cell is equivalent to a node. The problem is that the walls of the maze are between one cell and another, not therefore occupy a particular cell. How can I make it clear to the algorithm that where there is the wall is not camminabile?
     
  2. Bolt

    Bolt

    Joined:
    Dec 15, 2012
    Posts:
    296
    this is an example of the maze that I created. In the end all boxes will be set to "walkable" I did not understand how I can do.
     

    Attached Files:

  3. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    ya sorry i read wrong :)
     
  4. Bolt

    Bolt

    Joined:
    Dec 15, 2012
    Posts:
    296
    thanks anyway
     
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,376
    When you make your node graph, the 'find neighbours' should return only those neighbour nodes that don't have a wall between them.
     
    Kiwasi and Kurt-Dekker like this.
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This. AStar is a graph traversal algorithm. Before you can use it you need to have a sensible graph built.