Navmeshing in AR
I'm using Vuforia's ground plane stage to generate a world. On this world, there are little characters that spawn at runtime (children to the world) and are navmesh agents to the world. In the editor in play (using a standard camera without AR), this all works fine and the characters roam around as expected but when I build for android and the world is generated they spawn really high up and roam around in an area nowhere near the cube. Any help is appreciated because I'm stumped!
Answer by lyesderouich · Jan 06, 2019 at 04:32 PM
I'm facing the same problem and i ve been googling this for some time and still no answers. As a workarround , still not tested and not a clean solution is : I already have a plane attached to my Ground Plane Surface ( or Image Target ) so i need to generate a nav mesh at runtime on that plane. Downside : Big scalled plane will take so much time to generate a nav mesh and with little scale, it may be not enough surface for your player movements.
Hello. I've since come up with a solution to my issue, but you probably won't like it! I'm now using AR$$anonymous$$it due to developing an app for iOS and the only solution we found was to basically break the AR.
Traditionally, the origin of the world at run time is the camera (phone). This means that the content of the world is always moving around the camera. Our workaround is to now move everything around the object rather than the camera.
There's a decent bit of info on this, try googling "scaling in AR". There's also a git page for a basic implementation of this in AR$$anonymous$$it. I'm not going to lie, it's a massive pain in the ass so you're probably better off just creating some kind of A* pathfinding manually
Hello Again, i'm back with a solution this time which quite works well with vuforia ! If any one happen to face this problem, Unity's new Nav$$anonymous$$eshComponent which is not available with the editor (Current version : 2018.3) can be found here : https://github.com/Unity-Technologies/Nav$$anonymous$$eshComponents , and it actually works well and generate correct Nav $$anonymous$$esh Surface on runtime .
HI, Navmesh is regenerated at runtime but the object position float as I move the camera How can I make the object move on navmesh without camera affecting its position
Answer by tormentoarmagedoom · May 22, 2019 at 11:41 AM
Hi all.
When Instantiating objects that will act as NAv mesh agents, is 100% recommended to change its position, but also use Warp function to be sure they "go in" the namesh area.
https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent.Warp.html
You need also to check the agents offset so the mesh do not appear too high or under the navmeshareara.
Ps: If post some image of scene, inspector, icheracy, etc... maybe we se something else!
Bye! :D
Hi - In my project agents are moving on the navmesh and the navmesh data is updating dynamically using "Nav$$anonymous$$eshComponents" according to the AR camera movement, but when the camera is moving it is also translating the agents in the level (if the camera is moving towards left all the agent move left or if the camera moving right all the agents move right) - This is happening only to the navmesh agent - Stationary objects are good
Are the agents child of something? something like the player? IF agents are child of the player, as player moves, agents will also move...
Here also same issue!!! @sandeepraj
Answer by Fuongen · Jan 21, 2021 at 02:21 AM
For those who are still looking for an answer for this problem;
Click on AR Camera which is on your scene, then there is a script attached to the AR Camera which is "Vuforia Behaviour" script. It has "World Center Mode" option and "DEVICE" is selected as default. You need to change it from "DEVICE" to "SPECIFIC_TARGET" and as a target you should choose your "Image Target". After that, your Nav Mesh Agent should be working very well in AR as it works with normal camera.
Your answer
Follow this Question
Related Questions
In AR project how to move Navmesh agent without getting affected by the AR camera position? 2 Answers
What does desiredVelocity do? 0 Answers
Navmesh point 0 Answers
NavMeshAgent Issue 0 Answers
How to exclude certain navmesh obstacles on runtime? 2 Answers