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?
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.
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
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.