Navigation mesh not excluding static objects

Hi. I have a question. I have a simple shaped static object, that I want to place in the game world, inside the navigation mesh on my map.
Static objects should be excluded from navigation (unless on the top of them). Now my object does some stuff, that I want to get rid of. How?
When I fly inside this object in editor, I can see that the navigation mesh is excluded just around the edges, but not inside, in the center. This image ilustrates my issue :

Now, please don't tell me to use separated navigation mesh in Exclusion mode. The reason for this is, that I MUST spawn this object on the run in C++, so I can't create navigation mesh(Unless someone provides some way to create nav mesh on the run, then I can exclude, but I failed at that).

So the question is. Is there anything wrong with my model? What's the reason for that, and how do I fix it?
Cryengine tutorial videos on my Youtube channel! Check it out !

Re: Navigation mesh not excluding static objects

I found, that creating static mesh on the run does not effect the navigation area baked in editor. Just debugged game launcher. So that issue above is no longer an issue, because I can check if point is navigable and possible to reach easily by using ai methods. But the issue is that creating static mesh in c++ will not disable navigation in this area, and this is major issue for me. I have to either figure out the way to create nav mesh that will be excluding certain agent from navigation in this area, or create some stupid algorithm that will check if given point is contained within some rectangle.

Problem is solved! There is a example code that will allow you to create navigation mesh/exclusion mesh from C++

Code: Select all

// verices are the points that define you nav mesh; you can have more than 4 obviously
Vec3 meshVertices[4];
meshVertices[0] = m_pEntity->GetWorldPos();
meshVertices[1] = meshVertices[0] + Vec3(5.f, 0.f, 0.f);
meshVertices[2] = meshVertices[1] + Vec3(0.f, 5.f, 0.f);
meshVertices[3] = meshVertices[2] + Vec3(-5.f, 0.f, 0.f);

INavigationSystem *pNavSystem = gEnv->pAISystem->GetNavigationSystem();

NavigationVolumeID volumeID = pNavSystem->CreateVolume(meshVertices, 4, 5.f);
INavigationSystem::CreateMeshParams para;
para.origin = meshVertices[0];
para.tileSize = Vec3(10.f, 10.f, 10.f);
para.tileCount = 100;
NavigationAgentTypeID agentID = pNavSystem->GetAgentTypeID("MediumSizedCharacters");
NavigationMeshID meshID = pNavSystem->CreateMeshForVolumeAndUpdate("NAVMESH", agentID, para, volumeID);
//if you want this mesh to actually disable navigation, uncomment line below
//pNavSystem->SetExclusionVolume(&agentID, 1, volumeID);

pNavSystem->SetMeshBoundaryVolume(meshID, volumeID);
pNavSystem->RegisterArea("NAVMESH", volumeID);

Cryengine tutorial videos on my Youtube channel! Check it out !

Who is online

Users browsing this forum: No registered users and 1 guest