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

Using path finding with large objects.

Discussion in 'Scripting' started by Epic-Username, Jun 4, 2016.

  1. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    I have set up a tile based node system which is used for my a* path finding algorithm which was designed for objects 1 tile or smaller in size. But the problem i'm having is that some nodes are close to walls and large objects bigger then 1 tile get stuck how can i fix this?
     
  2. cjdev

    cjdev

    Joined:
    Oct 30, 2012
    Posts:
    42
    One way you could do it is to have a check for clearance when a big object goes through the A* flooding algorithm to find valid paths and exclude anything that would get it stuck.
     
  3. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    I have lots of objects already using a* which slow down the game now and adding checks for close objects would slow down the game A LOT.
     
  4. cjdev

    cjdev

    Joined:
    Oct 30, 2012
    Posts:
    42
    You're going to have to check for close objects somehow, but you could also just make a larger grid for your larger objects. It gives you more overhead but at least it keeps the proximity checks down in your algorithm.