Forum Discussion
Squashi11
1 year agoStart Partner
MRUK Scene Navigation for All rooms
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 Navigati...
Yago82
1 year agoHonored 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 😄
Squashi11
1 year agoStart Partner
Ayoo, thank you so much for this solution! I hope we get an official fix for this in at least in v182 update 😛
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 months ago
- 10 days ago
- 2 years ago