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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Navmesh painting areas ....

Discussion in 'Navigation' started by Zace666, Feb 10, 2019.

  1. Zace666

    Zace666

    Joined:
    Jan 28, 2014
    Posts:
    21
    I am trying to set up a terrain whereby my lil minions with use their AI to journey along roads and paths, rather than taking a beeline straight over a mountain.
    Looking in the Navigation window and the Areas tab I see that I can set colours to area and the associate a cost to them -this is great - EXCEPT how do i assign the colours to various areas of terrain? Can I paint the hillsides in a certain colour associated with hills and a movement cost of 2.5, sidewalks as another colour and a movement cost of 0.75 to hopefully get them to walk alongside a road?
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Unfortunately it's not that simple to assign different NavMeshCosts per surface out of the box.
    If you take a look at the NavMeshComponents package, you'll see that there are NavMeshModifierVolumes.
    Your best approach would be to place these volumes on hill slopes and such to set this up properly.
    This is possibly a lot of manual work, so if you think it'd be more efficient to write an editor script for this, you'll probably want to use the Terrain's height map to scan for the right differences and create Modifiers accordingly.
     
    Zace666 likes this.
  3. Zace666

    Zace666

    Joined:
    Jan 28, 2014
    Posts:
    21
    eeep - thats not looking fun or easy....