Static Mesh Complex Intersection

Fairly new to Unreal, so…
I have several structures that consist of many Static Meshes.
I want to query which of these Meshes intersect each other (using the Complex Collision).
So, if the parts are A B C D E, we might have AC, CE, BD, etc…
Is there a way to query this? (In C++)

1 Like

Assuming you are using components for these static meshses, please refer to these functions, defined in PrimitiveComponent.h

Nice, thanks a lot. I’ll start digging there.

— Edit:
From what I can tell, these end up in FBodyInstance::OverlapMulti, where it says:
//we skip complex shapes - should this respect ComplexAsSimple?
But I need the check for Complex Shapes…

So I’ve been looking at it for a while now, but apparently it explicitly skips the Complex types (Heightfield/ Trimesh).
Am I missing something? Does it not exist for Complex types?

1 Like

Typically you won’t run complex collision detection as it’s incredibly expensive.
If you absolutely need vertex to vertex collision then you might want to consider looking into how UseComplexAsSimple is utilized when set in the static mesh editor.

Thanks for the reply!
The cost wouldn’t matter, because I’d need to run it only once. Result could be saved in a file.
Still, I don’t see something like
bool Collide(StaticMesh* a, StaticMesh* b);
(but I didn’t spend the last 5 days looking, was busy with other stuff).

I know this is an old thread but felt it was important to add the results of my own investigations since the behaviour is not documented.

It turns out that UseComplexAsSimple does not apply to the component being tested for overlaps. As mentioned above complex shapes are explicitly excluded.

However, it does apply to components which may overlap the tested component.

So, you can detect when a simple shape overlaps complex shapes but not when a complex shape overlaps anything.

//we skip complex shapes - should this respect ComplexAsSimple?

They should have documented the omission at least!