Hi, I have been looking for a way to do overlap checks against the geometry of an actors. But as far as I know, there only exists overlap checks that trace against the world. While this does what I want it to, it seems like there is a lot of wasted performance when we keep checking against the world instead of the actor we are interested in.
Currently I have this code to return a boolean based on if a box is overlapping with anything in the world:
return FPhysicsInterface::GeomOverlapBlockingTest(
World,
FNavMeshStatic::CollisionBoxes[LayerIdx],
GetGlobalLocation(ChunkLocation).ToVector() +
FNavMeshStatic::NodeHalveSizes[LayerIdx],
FQuat::Identity,
ECollisionChannel::ECC_WorldStatic,
FCollisionQueryParams::DefaultQueryParam,
FCollisionResponseParams::DefaultResponseParam
);
This method was used inside the ::OverlapAnyTestByChannel method in WorldCollision.cpp.
But in my specific use-case, I have access to the actors I would like to do these overlap checks against. So for example, I have a basic box shape, and would like to know if this shape is overlapping with the geometry of a certain actor.
This is for a custom navigation-mesh I am developing, and I have a list of all the actors I’m interested in for generating this navmesh. Doing overlap check against the world every time seems like a waste of performance when I know exactly what actors I should be checking against.
Edit:
I’ve found this method in the PhysInterface_Chaos.h
static ENGINE_API bool Overlap_Geom(const FBodyInstance* InBodyInstance, const FCollisionShape& InCollisionShape, const FQuat& InShapeRotation, const FTransform& InShapeTransform, FMTDResult* OutOptResult = nullptr, bool bTraceComplex = false);
Is has a comment declaring that it is ‘a trace function for testing specific geometry (not against a world)’. I will check it out and see if this is what I am looking for.