Search Unity

[SOLVED] Custom navmesh shape?

Discussion in 'Navigation' started by Inferi, Aug 15, 2017.

  1. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    Im trying to bake a navmesh on my terrain but I do not want it to bake the whole terrain with walkable, only the white part as you can see in the bottom image:


    I have tried making a tubeform mesh and placed it in the terrain and made that to a non walkable area but it still bakes the whole terrain to walkable.

    The terrain is a total of 20 000 x 20 000 so baking takes some hours, so to see the wrong result after several hours of waitning is frustrating to say the least :)

    I have been baking this 4 times now and I think its about 3,5 hours every bake :(

    Do anyone know how I can fix this?

    I do not have any money so paid third party addons is a no go sadly.

    I need a AI to follow the player around and stop within a distance from the player. The IA must be able to go around obstacles.

    Any help would be very appreciated
     
  2. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    help? :)
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Tried disabling Navigation Static from terrain?
    Or disable terrain while baking..

    upload_2017-8-16_18-23-54.png
     
  4. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    If I disable Navigation Static from terrain, wont that mean that the navmesh wont work on the terrain?
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    oh yeah, it wouldnt probably work properly if terrain is not flat on that area..
    (was thinking you just use the flat mesh as navmesh area)

    maybe could export terrain as obj,
    cut out unwanted parts from the mesh (with blender or others), then use that mesh for baking..
     
    Inferi likes this.
  6. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    Yes, I will try that again.
    I tried it yesterday but the file was over 2 GB in size so it would not load into blender. Ill try to export it at a lower resolution.
     
  7. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    So. it did not turn out as I hoped. lower res = not correct heights so some areas where under the terrain. So still no fix.... I have no idea on how to even start with the coding to make it without a navmesh... :(
     
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Inferi likes this.
  9. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    I think I have fixed the navmesh now. changed it some in Blender and it looks like it follows the terrain pretty well now.I just need to test it :)
     
  10. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    So I needed to export my terrain in half res using "http://wiki.unity3d.com/index.php?title=TerrainObjExporter"

    I then import it into Blender. I cut away the parts that I did not want and then exported to ".obj".

    I imported it into Unity.

    Placed the mesh at 0,0,0 and then tried to put it as close to the Terrain as I could "just enough to see it commin up of the terrain"

    I then made the Terrain "not static" and made the mesh static and walkable.

    Baked and then after it had baked I just took away the mesh.

    I now have the navmesh that I wanted and it seem to work :)
     
  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    btw. check out 2017 with area/volume baking from 17min -->
     
    Last edited: Sep 22, 2021
    mulova and Inferi like this.
  12. Inferi

    Inferi

    Joined:
    Sep 28, 2015
    Posts:
    145
    I'll definitely do that tonight. Thanks :)