Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Navigation mesh + ARKit > Dynamic Scale?

Discussion in 'Navigation' started by sama-van, Aug 10, 2017.

  1. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    Hi!

    Recently have to make a RTS game with the ARKit.

    As usual, making the static navigation mesh from a single scene to bake the ground from the Editor.
    Obstacles are mostly "Nav Mesh Obstacle" which can be make & moved in run-time, rest are NavAgents.

    Well everything working just fine.

    Now with the ARKit :
    - I first detect a flat surface which size depend of the Anchor detection.
    - Next I scale the entire 3D Assets, gameplay components, etc with a scale coef proportional to the AR Anchor.

    Entire GamePlay settings, and 3D assets with new scale factor are ok, the game is running just fine, etc...

    But with the static NavMesh generated from the ground only from Editor, won't be scaled...
    Actually not sure if I can even access to the navmesh data to scale it.

    Then my question is the following :

    As long as I need at least a NavMesh for the ground, to make the NavAgent on Start(), which solution do I have to maybe generate the base Ground Nav Mesh on runtime? Any solution for this? New features I could recently miss?

    Cheers! :)
     
  2. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
  3. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    It seems the thread from the "welcome-new-navmesh-features-experimental-preview.438991" thread can't be replied...

    The dynamic nav mesh script is working, using "NavMeshSourceTag" in runtime then I scale down the object and the navmesh to be updated.

    But the smaller become the object the weirdest become the navMesh.

    I guess this come from the Scene Navigation's settings via the Agent Radius and Height...
    But no idea how should I edit those in run time...

    Really no other way with the AR kit, I do not see any other possibilities than scaling down the asset :(

    Any tips please? :(

    DunamicNavMeshScale issue.png
     
  4. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
  5. jackworld

    jackworld

    Joined:
    Oct 31, 2014
    Posts:
    2
    why you don't try to scale camera?
     
  6. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    Scaling the camera you said?
    Any exemple?....
     
  7. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
  8. aldian

    aldian

    Joined:
    Jul 28, 2012
    Posts:
    32
    Would just limiting the scale of the object from going below 1 not be a simple fix?
     
  9. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    ARKIT has no limit on scale.
    Image a mini town that should pop front of you as a miniature.
    1 unit become 0.01 in the best case.
    Now the navmesh only works on a base unit = 1.

    I finally wrote my own pathfinding script which works a charm at every scale and possible to force scale in runtime too :)
     
  10. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    91
    I'm having the same issue, how did you get round it?
     
  11. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    Last edited: Sep 22, 2017
    andalf and zeb33 like this.
  12. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    91
    Thanks
     
  13. ZroeX

    ZroeX

    Joined:
    Oct 20, 2010
    Posts:
    10
    Hi , sama-van
    I have same problem , when I bake nevmesh for arkit.
    Did you fixed this problem ?
     
  14. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    As previously said I wrote my own pathfinding script...
    No news from Unity support at all :)
     
  15. ZroeX

    ZroeX

    Joined:
    Oct 20, 2010
    Posts:
    10
    ok
    i see the ARKit Plugin on Git .
    they are testing content scale , maybe it can fix this problem . :)
     
  16. Killbert

    Killbert

    Joined:
    Mar 20, 2014
    Posts:
    3
    Hi Sama-van,

    I ran into a somewhat similar issue when I scaled 3d gameobjects to 0.1. Huge gaps in my navmesh around the static blocking objects. However, when I applied a very low value to the agent radius (0.01) and re-baked the nav mash, this solved these gaps for me. (I was at first only looking at the advanced voxel settings which didn't do anything for my problem).

    My situation is somewhat different from yours as I do not require to apply realtime navmesh baking to my game, but still might be worth a look.

    One thing I didn't understand from your situation, is why you would want to scale gameobjects at run-time, but that's probably a conceptual issue. In my case, the models I use in my game (buildings, vehicles etc.) are of a fixed size. Wherever the player places them in the AR world doesn't effect their size. If the plane is far away in 3d space, the objects appear small and if you bring your camera in close, they grow in size like they should in real life.
     
  17. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,505
    Well the scene was firstly made at scale 1 (character and props , etc...).
    But well to pop a scale 1 level on ARKIT means that everything looks super real around you.

    The game is a RTS-like but actually the scene should pop on a board and where player is able to move units around.

    Then now take an entire levels with church, houses, streets, etc.. and you should scale it down to make it fit on a table.
    Well that is actually like scaling everything down by 100 ( actually even smaller...)

    Finally props and other units can appears, disappear, that is why I need to update the navmesh in run time. (which is well handle by Unity). but at very small scale the navmesh system from Unity is simply not efficient even working.

    And then I ended up writing my own navmesh system witch fit very well with the game I wrote.