I have a custom actor in my level which is spawning static mesh instances representing the geometry of my level at runtime. I have created a NavMeshBoundsVolume and set it’s extents to cover the entire area I could possibly generate geometry in. My project settings has rebuild navigation at runtime checked, as does the rebuild at runtime setting in my level’s recastnavmesh instance.
This is what I end up with -
Which is not what I want… I want all the static meshes to be covered by the nav mesh. Is this intended behavior or do I need to tweak some setting on the navmesh / project somewhere?
Thanks,
Edit : Someone in IRC suggested I take a look at the collision settings of my meshes, so I removed all collision meshes from the meshes I am referencing in my instanced static mesh components, and replaced them with simple box collision meshes. I checked the collision settings on the instanced static mesh components themselves and everything seems to be good, but still not working
Okay it seems that after all my meshes are generated, if I change the collision object type of one of my instance static mesh components, the navmesh regenerates correctly. If I do this in code however, it doesn’t seem to work. Still need help on this. Also it doesn’t matter what I change the collision object type to - both world static and world dynamic work and cause the nav mesh to update properly.
Hi TJ, I’m currently checking out a fresh copy of the engine to do some investigation to see if some code is being called when I set that variable in the editor vs when I do it inside my actor. If I can’t figure it out / switching to the git hash version of the engine doesn’t fix it for me I will upload and link.
I was able to get the recast nav mesh to regenerate correctly by calling AActor::ReregisterAllComponents() on the custom actor which holds reference to my instanced static mesh components. I noticed that when I changed a property in the editor, this function was being called, so I called it myself and navigation seems to have righted itself.
I doubt this is the ideal way of addressing the problem, but until it presents a problem I’ll accept it as a solution.
Thank you for this! Also, sorry for necroing; I came across this problem today in 4.8 and wanted to add that calling AActor::UpdateComponentTransforms() is sufficient to fix this. ReregisterAllComponents() is significantly more expensive and if you have lots of dynamically spawning instanced meshes, only updating transforms should be much more performant!
Necro #3: I tried to debug this issue in 4.17.2 (yes, it’s still there…). The code in HierarchicalInstancedStaticMesh.cpp:2700 seems to be correct to me, but for whatever reason the return value of FBoxSphereBounds::GetBox() (which is being called there) seems to be an invalid box, what should be impossible as far as I understand the code… I haven’t tried this in a debug build of the engine yet, but I wouldn’t even be surprised if it turned out to be a bug in the compiler used to make the engine build…
For me I was able to fix this in blueprints by disabling actor collision then reenabling it again on the actor that has the instanced static mesh component.