Does AI pathfinding system work in xr simulation env?

I am working on creating an enemy AI pathfinding system within an XR simulation environment. I’m trying to use spatial data for NavMesh-based pathfinding, but it’s not functioning as expected, or I didn’t have a good solution, Can anyone provide guidance on how to effectively implement NavMesh-based pathfinding or other method in a simulated XR environment? Also, are there alternative methods for AI pathfinding in this context?

Hi there! Sorry to hear you’re having trouble. You should be able to use NavMesh with AR data. For MARS, we had a com.unity.mars-nav-mesh package to add this functionality and used it to create some of our samples. This package won’t work on visionOS, but you can check it out for inspiration. There were some particular challenges to setting up a nav mesh on surfaces that are constantly changing, but other than that we were able to use nav mesh in the normal way.

1 Like

Thank you for your reply! Mtschoen! Are there any other means or solutions that can replace AI navigation in the unbounded XR mode of VisionPro?

There’s this package from the Asset Store, and a few others. But our built-in Navmesh feature should work… What kind of issues are you running into?

1 Like

sorry last reply didnt see that clearly MARS nav mesh

I’m currently working on where the goal is to have the enemy AI navigate towards the player within a simulated XR environment. it was easy to setup in tradional way, but the approach involves generating spatial data and then using this data to create a NavMesh, which should guide the enemy AI’s pathfinding. That’s the plan I have in mind, then finding myself stuck halfway through the process

Yeah that sounds similar to this demo. Am I getting this right?

If that’s what you’re after, the basic setup is that your AR Plane prefab has a NavMeshSurface component which will generate navmesh for each surface, and you automatically create offmesh links to other surfaces (that’s the hard part without MARS). Maybe we could create a similar sample for visionOS, but you can probably piece it together with the code in the MARS navmesh package.

appreciate it Mtschoen! I’ll give it a try!

Hi Mtschoen, I’m currently using MARS navmesh along with its templates, but after importing the polyspatial and visionOS packages, I encountered hundreds of GUID errors. Normally, I would just import the packages while MARS is installed. I’m looking for suggestions on how to integrate the code from the MARS navmesh package effectively. Also, I’m curious about which MARS packages are unnecessary and can be avoided during import

Ah, yeah I wasn’t suggesting that you actually use the MARS packages… just take a look for inspiration :slight_smile:
I think the issue you’re seeing is that visionOS packages use com.unity.xr.core-utils while MARS uses com.unity.xrtools.utils. We renamed com.unity.xrtools.utils to com.unity.xr.core-utils and did a bunch of breaking changes, but I think there are a bunch of scripts and things that stuck around with the same guids. The MARS nav-mesh package also includes the NavMeshComponents assets, because the package version of this didn’t exist at the time. So you might be seeing guid conflicts there, as well.

Unfortunately, we don’t support MARS on visionOS.

Understood, I’ll try some other solutions for this, thank you very much!