All weekend i wasted time to get any solution on my needs. And, i did nothing.
I want to share my research and request feature adding.
Nav Modifier Volume
I did not found a way how to create it or spawn it during runtime. Example would be great. Also as i understand right, Nav Modifier Volume can only block path construction in place where it located. I tried to locate NavArea_Null and NavArea_Default above my skeletal mesh, and in both times i had no navmesh was built above skeletal mesh.
Blocking Volumes block traces to actor behind it. Also, i tried to create it during play, but i did not get it to work, i do not know how to do it in c++ during runtime. Example would be great.
Volume it is not component and can not be used as component, so i need to create it at runtime, get pointer, then set size, set relative location, and move up or down when needed. I hope it can be sized and moved.
The best way as i can see - it is to use box component. It can be created in constructor, and then all properties can be set in blueprint. I can set extent of box there, after i can get scaled extent in c++, i can set relative location, and move it around root component.
BUT! It does nothing with collision! And interesting why? Maybe it is a bug.
* A box generally used for simple collision. Bounds are rendered as lines in the editor.
class UBoxComponent : public UShapeComponent
So, in blueprint i have skeletal mesh component with no collision, and box component with collision preset “Block all”. Navmesh is not generated above this object placed in map, but this object can be get with trace. I do not understand why navmesh was not built above this object.
Look at screenshot:
Also, instead of box component i have tried to use static mesh component. So my blueprint had skeletal mesh and static mesh. Skeletal mesh without collision, and static mesh with collision “Block all”. Static mesh - i have used “Shape_Cube” from engine assets. And i have 2 different results with it.
SM.1 If i create staticmesh component in constructor:
MeshBox = PCIP.CreateDefaultSubobject(this, TEXT("MeshBox"));
Then in blueprint in components sheet i set staticmesh to “Shape_Cube” and set bounds, then i do not see staticmesh and i see only fringe lines of staticmesh. Navmesh above this object on map was not generated, and during runtime it works like there is no collision.
Also, looks like here is same thing i had in other thread:
There, when i tried to add sprite component in c++ constructor, then i did not see sprite texture in blueprint. But if i tried to add sprite component in blueprint component sheet then i see sprite texture in blueprint.
SM.2 If i do not create staticmesh component in constructor, and i am adding it in
components sheet of blueprint, then if i set staticmesh to “Shape_Cube” then is see mesh with material in blueprint and in object placed on map. Also in that time navmesh is generated above that object, but i have no pointer of staticmesh in code, to move it. Also, it is strange, why static mesh creation in two different times get such a different result with view and collision. I think it should be same. It means i did something wrong when i created staticmesh component in c++.
For now i still did not get any workable solution.
It would be great if Epic games can make skeletal mesh to be walkable by characters, because some of skeletal meshes can be just static actors with animations.
Also, It would be great to get a way to set some areas to be non walkable during runtime, like in UE3 it was done with dynamic obstacles (or just maybe give an example of how to spawn Nav Modifier Volume during runtime to make it acts like obstacle)