Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Injecting influence map into navmesh

Discussion in 'Navigation' started by laurentlavigne, Sep 24, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    can an array of weights be injected inside unity navmesh? Either as a dynamic weight zone like those carving colliders or as a direct append to the navmesh polygons
    That's to influence the path finder euristic
     
    Last edited: Feb 9, 2021
  2. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    I have been looking for the same thing. So far I made a grid and projected on the closest navmesh point using sampleposition. On this grid I have the influence values
     
    laurentlavigne likes this.
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    How do you weight pathing like that?
    I can only weight the AI decision to target an area, not the path it takes.
     
  4. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
  5. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    Also I realized that you have been looking for a solution since 2012 which is almost 10 years now!
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    oh the solution is simple: roll your own or buy aron granberg's ;)
    I'm just poking the bear once a year to see if it woke up from cryo.
    We're lucky on this one because it was made back in the day when they gave a F***, plus it was made by the man himself so it's more than functional.
     
  7. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    The A star project does look interesting and it supports waypoint pathfinding, which is what killzone 2 used for their influence map implementation
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    Oh I thought killzone used recast as well, I like recast because it's less work :) last glance I gave garnberg's stuff it doesn't allow for dynamic weighting on navmesh, or like you 're about to do, weight grid projection.
     
  9. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    The weights would be my own, and I could position it on the waypoint or grid. Do you use recast with unity?
    .
     
  10. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    Unity's navmesh is recast, also made by Mikko "DigestingDuck" Mononen
     
  11. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    I ended up projecting the grid of weights on the navmesh around NPCs and then calculating the navmesh path to the least costly point. This is how it looks at the moment.
     
  12. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    this is good!
    how do you project a grid of weight on a thing made of arbitrary polygons?
     
  13. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    It’s an array of points around the NPC. I match it with the ground using sample position for each point
     
  14. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    so on each AI tick you do that check?
     
  15. gdg

    gdg

    Joined:
    Jul 8, 2013
    Posts:
    18
    Yes, in one frame only one AI is updated
     
  16. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,225
    that's cool, staggered AI gets a lot of mileage.