Builtin overlap check is too slow. Any alternatives?

We use the builtin ‘OverlapMultiByChannel’ for checking if a certain shape overlaps anything in the world. Sadly, there is no builtin method that directly compares a given shape and actor, and see if they intersect each other without tracing the actual world they are in.

The reason I want this is because the current ‘OverlapMultiByChannel’ is too slow for my use-case where I am generating a 3d navmesh.

As an example, I profiled my generator, which generates a 3d navmesh from 50 thousand actors with these timings:
image
The entire generation takes 3.1 seconds, where 2.8 seconds is spent solely on the overlap check. The remaining 0.3 seconds is used for setting the entire navmesh data structure.

Does anyone know how the builtin world overlap checks work under the hood? I’ve read a bit of the source code behind it, but it’s very convoluted and does not contain any comments. I’m specifically interested in a simple → shape intersects with actor/component/mesh. Perhaps its better if I built my own check if we have access to the geometry of an actor?

I’ve found a more performant check, the ‘FBodyInstance::OverlapTest’ method does exactly what I required. It tests if the bodyinstance overlaps with a given shape like a box/sphere. It does not trace against the world which saves a lot of performance.

In my case it reduced the generation from 3.2 seconds to 2.4 seconds. There is also a ‘OverlapTest_AssumesLocked’ version which is not thread safe, but is fine in my case. This reduces it further to around 2 seconds. This is much faster. I will look at the source code and try to trim any unnecessary parts to improve it even more, but that will be specific for my use-case.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.