SlipperyBrick Posted December 23, 2023 Share Posted December 23, 2023 Adding a NavMesh object from the editor and then running the game shows no nav meshes in the scene. Calling CreateNavMesh() to add a NavMesh object from code also doesn't show nav meshes in the scene either. EDIT: Both m_navmeshes and navmeshes members in the `scene` object are 0 (love the m_ prefix, very old school) Quote Link to comment Share on other sites More sharing options...
SlipperyBrick Posted December 23, 2023 Author Share Posted December 23, 2023 Steps: - Add NavMesh via editor: 1. Use Object panel to add Navigation Mesh to scene 2. Debug game - Add NavMesh via code: 1. In main.cpp add following code after loading map: auto navmesh = CreateNavMesh(world, 0, 8, 8); navmesh->Build(); 2. Debug game Quote Link to comment Share on other sites More sharing options...
Andy90 Posted December 23, 2023 Share Posted December 23, 2023 For some reasons its also not possible to create a NavMesh wich is a bit bigger. I try it with this->nav_mesh = CreateNavMesh(entity->GetWorld(), 5, 16, 16); this->nav_mesh->SetPosition(0, 0, 0); this->nav_mesh->Build(); and get the following result Error: dtNavMesh::addTile failed it Prints this output multiple times. If i do the NavMesh with 8x8 its fine. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 23, 2023 Share Posted December 23, 2023 Will do some more testing on this... Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted December 24, 2023 Share Posted December 24, 2023 Okay, so it looks like it is not even being saved at all in the map file: I will continue to investigate why... 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted December 24, 2023 Solution Share Posted December 24, 2023 It looks like the error is only in the editor, and not in the engine library itself. I updated the editor and this example works: start.zip #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto cl = ParseCommandLine(argc, argv); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load the map WString mapname = "Maps/start.ultra"; auto scene = LoadMap(world, mapname); auto navmesh = scene->navmeshes[0]; navmesh->SetDebugging(true); auto agent = CreateNavAgent(navmesh); auto player = CreateBox(world); player->SetColor(0, 1, 0); player->Attach(agent); auto camera = CreateCamera(world); camera->SetPosition(0, 1, -4); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) agent->Navigate(1, 0, 0); world->Update(); world->Render(framebuffer); } return 0; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.