Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Navmesh not rebuilding

I am making an RTS and have entered the phase of learning the AI component so that my "citizens" can be totally autonomous (think Tropico.) I'm at the very early stages of learning the AI system now but I am able to get characters to move across the map towards a building (mesh) that I place for "construction"; however, I have noticed a hitch. When I place the building and have the AI go to the "rally point" at the front of the building, if the AI is coming from the rear of the building, he hooks and stops moving at the mesh but the Behavior Tree keeps ticking because he hasn't reached his destination. At first I thought it had to be my blueprints and/or behavior tree but have since realized that when I place a mesh into the world during runtime, the navmesh is not updating to accommodate the new mesh and therefore the AI never recalculates to go around it.

Having found a similar question, I saw that you need to turn on the Runtime Generation to "Dynamic" and I also checked the "Force Rebuild on Load" (tried without as well.) Neither of these solutions are currently working for me - the navmesh does not rebuild as would be expected. Is there a bug in the system or am I doing something wrong? Perhaps I need some sort of Recast node to run when the mesh is place or I'm missing another setting, although I've watched an Unreal Video with Ian and his works just fine with only adjusting the settings in his default.ini? I have tried this in 4.8.2 and have just upgraded to 4.8.3 but has the same effect. See my images below. Any help would be appreciated!

alt text

alt text

alt text

Product Version: UE 4.8
navmeshfail.png (2.2 MB)
navmeshblock.png (705.5 kB)
navmeshsetting.png (110.2 kB)
more ▼

asked Jul 30 '15 at 07:14 AM in Blueprint Scripting

avatar image

1.4k 70 29 92

avatar image jtsmith Jul 30 '15 at 10:48 AM

Bump. Can anyone help with this?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Did you set "dynamic" navmesh generation on RecastNavMesh instance on your map, or in the Project Settings? The project settings-way is the proper one. It's a know... missing feature ;)



more ▼

answered Jul 30 '15 at 11:51 AM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image jtsmith Jul 30 '15 at 11:05 PM

Hey mieszko, thanks for the reply. I did actually set that in the project settings, I didn't see any option on the level instance of the navmesh volume. I'm going to test it in a few minutes but I'm wondering if my "World Dynamic" collision is off in the BP; that is, if it even matters for that but figured I would test it out. Is there any other setting that I may be missing on this?

Thanks again Jesse

avatar image jtsmith Jul 30 '15 at 11:12 PM

Mieszko, I just tested the collision and as I would assume, it made no difference. I checked and the RecastNavMesh does show it is set to Dynamic, which I never personally set it, but double checked and the project settings is also set Dynamic.

avatar image jtsmith Aug 02 '15 at 06:03 AM

Any other solution mieszko or anyone else who may know?

avatar image jtsmith Aug 04 '15 at 12:42 AM

I still don't have a solution to this. Do you have any other suggestions as to what can be causing the problem @mieszkoz?

avatar image jtsmith Aug 04 '15 at 03:50 AM

@mieszkoz alright, I've done some further testing and I'm thinking what I am experiencing may be a bug. Let me give more detail:

What I am currently doing in my project (an RTS similar to Tropico) is I have Parent/Child/Grandchild blueprints for my buildings and also have a "Construction Proxy" for the "pre-construction" buildings. Using this type of hierarchy, it makes it simple to not create BP's for each and every one of my buildings by not having a mesh preassigned to the BP. In the construction script of each base BP I have it set the Static Mesh to the required mesh (depending on the building you are wanting to place.)

In my testing, I created just a basic BP with a starter content shape (pyramid) and spawned it into the world; the Navmesh recalculated properly. I took it one step further and deleted the default mesh and in the construction script I had it set the mesh to the same shape I used before. This time when the BP spawned into the world, the Navmesh did not recalculate.

I added the mesh (pyramid) back as the default and this time I used a completely different (and larger) mesh to set in construction (mind you I still have the base pyramid shape set as default) then spawned it into the world. Not only did it recalculate the Navmesh but it properly recalculated it to the new mesh I set in the construction script.

Conclusion: It appears as though in order for the Navmesh to recalculate properly, you must have a mesh assigned to the BP prior to construction, and then have the construction script change the mesh as needed.

This appears to be some sort of weird bug but at least I have found a workaround. If you do believe this is a bug then let me know and I will submit a bug report (or perhaps you can pass it on) but if you think it's expected default behavior then I will just stick with my workaround. Thanks!

avatar image Xarol Sep 07 '15 at 02:23 AM

Any updates on this? I think I am having a similar issue and this work around does not work for me. Is this fixed in 4.9 or is anyone at Epic interested in making the navmesh more robust?

Thanks, -X

avatar image jtsmith Sep 07 '15 at 06:44 AM

TBH I don't know if it was fixed in 4.9 even though I'm using it. If you read my last post you'll see what I had to do to fix it. I don't think it's really a workaround. When the BP is initialized if there's nothing in the mesh then it won't recognize it. I'm not sure if it's desired functionality or not. Just add any simplistic mesh to you static mesh component and when you switch it like I do through variables then it will work just fine.

avatar image MieszkoZ STAFF Sep 07 '15 at 02:25 PM

It's a known bug that our navmesh generation has issues with static meshes set up in construction script. In general Construction Script is a special case in many sorts of ways, and we haven't fixed it yet for navigation. Not deliberately anyway. However, there have been fixes done to handling of hierarchies of components and actors, and those should be in 4.9, and there is a chance the construction script issue would be resolved as well. Please give it a try and let me know.

Regarding a workaround, the provided one should work, but it may require the "default" mesh to be navigation relevant, meaning have relevant collision.

Alternative workaround would be to set the mesh in "Begin Play", that should work as well.



avatar image MaxSMoke777 Oct 12 '15 at 08:28 AM

Could you demonstrate this workaround in blueprints? I can't seem to figure out how to do this, and I'm having the same problem.

avatar image jtsmith Oct 12 '15 at 08:37 AM

I tested moving my code to Begin Play but issue is still there. I'm not at my PC so can't snap SS to show you but all you need to do is set the Static Mesh component of you BP to have a generic default mesh - I used a simple sphere or the pyramid mesh (both from starter content.) Then in my construction script I have it set the static mesh component to the mesh I truly desire. If you still can't figure it out then let me know and in the morning when I'm back in the editor I'll snap a SS and show you what mine looks like but it really is pretty simple. Let me know

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can enforce nav mesh refresh by adding a little location transform. Even better immediately after the location change you can reverse that change - it all happens in one frame so it wouldn't be noticed by the players.

more ▼

answered May 05 '17 at 09:34 AM

avatar image

239 3 42 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question