Navigation mesh + ARKit > Dynamic Scale?

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! :slight_smile:

Oh actually found this which look awesome :

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 :frowning:

Any tips please? :frowning:

1 Like

bump :slight_smile:

why you don’t try to scale camera?

Scaling the camera you said?
Any exemple?..

And then the ARKIT support team came with the camera scale idea, but it doesn’t really fit as a solution.

Below the topic URL which I explain a bit more what it is going :
https://forum.unity3d.com/threads/arkit-support-for-ios-via-unity-arkit-plugin.474385/page-25#post-3190512

Then I am still waiting for a fix, which could be a scale value from the navigation tab we could define the final world size.
In run-time as well please.

Would just limiting the scale of the object from going below 1 not be a simple fix?

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 :slight_smile:

1 Like

I’m having the same issue, how did you get round it?

1 Like

Read and applied this tutorial :

It took time to understand and have something working.
But now I am pretty able to do what I want…
Super useful for many things!

2 Likes

Thanks

Hi , sama-van
I have same problem , when I bake nevmesh for arkit.
Did you fixed this problem ?

1 Like

As previously said I wrote my own pathfinding script…
No news from Unity support at all :slight_smile:

1 Like

ok
i see the ARKit Plugin on Git .
they are testing content scale , maybe it can fix this problem . :slight_smile:

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.

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.

Just thought I’d add a working solution to this, since I just discovered it, and couldn’t find help anywhere else. A solution is to duplicate your world prior to scaling (essentially have an invisible, navmesh world), and then map navmesh positions to and from the scaled world. This only works for transforming the whole navmesh. It doesn’t solving the problem of a moving navmesh within a navmesh.

1 Like

Yeah 2023 still the same issue. Working with very small scale in VR / AR objects breaks the nav mesh

1 Like