Jump to content

Adding NavMesh via editor and in code causes it not to show up in the scene


SlipperyBrick
 Share

Go to solution Solved by Josh,

Recommended Posts

Adding a NavMesh object from the editor and then running the game shows no nav meshes in the scene.

image.thumb.png.20b5db8d998e0a13df09a733d1eea359.png

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)

Link to comment
Share on other sites

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.
 

Link to comment
Share on other sites

  • Solution

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;
}

 

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...