cancel
Showing results for 
Search instead for 
Did you mean: 

MRUK Scene Navigation for All rooms

Squashi11
Protege

I am building a game the leverages navmesh in multiple rooms but no matter how many things I change the SDK doesn’t seems to generate more than 1 room navmesh at the same time.

 

The Scene Navigation component is set to ALL ROOMS. I can provide any logs necessary. The project is using the latest v65 SDK and is running on the latest unity 6 preview version.

5 REPLIES 5

BogomilPetrov
Protege

Hey mate,

I'm having the exact same problem with the same things.

Unity Meta SDK v67. 

-All the (Building Block) Find Spawn Location objects spawn in ALL rooms. Same as all the other official scripts.

-The Nav Mesh Example scene runs fine in 1 room. With the same setting you mentioned it only spawns in 1 single room.

- The "All Rooms" Option seems to do nothing, Maybe it does generate meshes in all rooms but the Agents cant access those.

 

+I tried setting the Scene Obstacles to not include Doors and Invisible walls but its all the same.

 

Note: To build the next evolution of Mixed Reality we require robust tools. Myself and other developers are already pushing everything forward but even the officially announced and supported tools don't work.

 

Any chance you can pass this on to someone deep in Meta or Unity @neurodivrgent @MetaQuestSupport 

hey . thanks for the reply. Yep as you described, its the same problem. I tried making a script that shuffles through every room and builds navmesh for it but it always crashes or freezes the application. So for now , meta SDK is no good for us 😄

Yep. I had sincerely hoped you had found something in the time from when you posted this to when I replied.

I think they're nearly there with it. Their other Building Blocks work flawlessly. There must be a reason this is just an example and not a building block.

 

I'll dig through the scripts in the Nav Mesh example and try to extract just the code that bakes the navmesh and triangulates it.

Yago82
Honored Guest
Hello, just today I was adding the functionality for multiple rooms to my Mixed Reality game using version 67 of the "Meta MR Utility Kit."
 
To my surprise, I wanted to generate a navmesh for all the rooms in my home and encountered the same issue you mentioned... it only generates a navmesh for the room the user is in. (I don't know if there are other issues, I only ran into this one).
 
Looking at the code in SceneNavigation.cs, when attempting to generate a navmesh for all the rooms, the room parameter is passed with its default value, null (line 136). Following the code, I believe the problem lies in the ResizeNavMeshFromRoomBounds function (line 239).
 
When room is passed as null, the function ResizeNavMeshFromRoomBounds obtains the bounds of the current room, setting the size of the NavMeshSurface to the bounds of that room, preventing the generation of a navmesh for the rest of the rooms.
 
In order to continue testing the game that I'm working, I removed this line and manually set the size of the navMesh to a very large value, allowing me to generate a navmesh for the entire upstairs floor of my home. 
 
For now, I left the code like this:

 

        public void BuildSceneNavMeshForRoom(MRUKRoom room = null)
        {
            CreateNavMeshSurface(); // in case no NavMeshSurface component was found, create a new one
            RemoveNavMeshData(); // clean up previous data
            //YAGO var navMeshBounds = ResizeNavMeshFromRoomBounds(ref _navMeshSurface); // resize the nav mesh to fit the room
            var navMeshBounds = new Bounds(gameObject.transform.position, gameObject.transform.localScale * 100f);
            var navMeshBuildSettings = CreateNavMeshBuildSettings(AgentRadius, AgentHeight, AgentMaxSlope, AgentClimb);
            if (!ValidateBuildSettings(navMeshBuildSettings, navMeshBounds))
            {
                return;
            }

            CreateObstacles(room);
            var data = CreateNavMeshData(navMeshBounds, navMeshBuildSettings, room);
            _navMeshSurface.navMeshData = data;
            _navMeshSurface.agentTypeID = navMeshBuildSettings.agentTypeID;
            _navMeshSurface.AddData();

            InitializeNavMesh(navMeshBuildSettings.agentTypeID);
        }

 

 

It's not an ideal solution, but at least for now it helps me keep testing this cool feature.
 
Tomorrow, if I find some time, I’ll try to rewrite that function to calculate correctly the bounds for all the rooms. As soon as I modify the code, I’ll share it here.
 
I hope this helps while Meta comes up with a more definitive solution. 
 
The mixed reality game with all the rooms is turning out something like this 😄
Yago82_0-1723667749813.png

Ayoo, thank you so much for this solution! I hope we get an official fix for this in at least in v182 update 😛