Depenetrating overlaps in C++

I’m trying to get the overlap info so I can depenetrate primitives, but in C++ I’m getting nothing back when I check like this:

TArray<AActor*> overlappingActors;
primitive->GetOverlappingActors(overlappingActors);

If I check overlapping actors in Blueprint I get the correct array of actors back, but in C++ it is always empty.

I tried passing an actor (from BP) into this, but still the results are empty.

TArray<FOverlapInfo> overlaps;
primitive->GetOverlapsWithActor(myActor, overlaps);

My ultimate aim is just to grab the penetration direction and depth from the Overlap Info struct array:

overlaps[j].OverlapInfo.PenetrationDepth

I also tried getting the overlap infos like this, but again no luck:

TArray<FOverlapInfo> overlaps = primitive->GetOverlapInfos();

Any ideas what I might have missed, some gotcha in the data maybe?

If there’s another way to get the overlap info that’s all I really need.

Depenetration works for components that block each other.
But components will not generate overlap events for something they’re supposed to block.

Hey Tuerer,

(bot blocked my other account :man_shrugging:)

All components involved are set to generate overlap and hit events (though I’m not using the events, I’m doing an overlap check in C++).

When you say ‘depenetration works’, which depenetration method are you referring to?

I mean, if components are set to block each other, there will be no overlap events, even if you check “Generate Overlap Events”. Thick of it as if for the engine, the components that are supposed to block each other, are never overlapping. The engine will try to depenetrate them.

But there no need to depenetrate objects that are supposed to overlap each other.

In short: meshed either depenetrate each other, or overlap. You can’t have both at the same time.

Even if you force them to physically penetrate each other, it will not count as overlap.

Oh I don’t mean depenetrating during the simulation, I want to calculate the depenetration vector in C++.