How Ignore mask in collision query params work?

/** Extra filtering done during object query. See declaration for filtering logic */
FMaskFilter IgnoreMask;

/** This filter allows us to refine queries (channel, object) with an additional level of ignore by tagging entire classes of objects (e.g. "Red team", "Blue team")
    If(QueryIgnoreMask & ShapeFilter != 0) filter out */
typedef uint8 FMaskFilter;

Solution:
Actor Team: team A and team B

TestActor(Team A) preform physics overlap detected with sight range, return actors only with team B

So how can I use IgnoreMask to filter actor with team B(like comment: e.g. “Red team”, “Blue team”)

Is there a way to get TestActor with spe tag with a phy overlap function?
Normally, get all Test Actors with array of Overlap result, and then loop for each TestActor and filter with tag. Like:

TArray Results;
    if (MultOverlap(Results, ....))
    {
         FilterResultsByTag(Results, "SpeTag");
    }

Someone help!

Does anyone know how this works? as I’m trying to use it to disabled collisions between groups of actors, and there doesn’t seem to be any documentation for this feature.

I’ve not used it myself, but I think you’ll be looking for the SetMaskFilterOnBodyInstance method: https://api.unrealengine.com/INT/API/Runtime/Engine/Components/UPrimitiveComponent/SetMaskFilterOnBodyInstance/index.html

There is some additional information here: https://answers.unrealengine.com/questions/542930/is-there-a-way-to-disable-collision-but-not-overla.html

Thanks

Yes I have tried setting the components of the first group of actors with
SetMaskFilterOnBodyInstance(1) and
SetMoveIgnoreMask(2)

and for the second group
SetMaskFilterOnBodyInstance(2)
SetMoveIgnoreMask(1)

I’m still getting collisions between the 2 groups, unless there’s something i’m missing.

for anyone reading this in the future, they are bit masks:
SetMaskFilterOnBodyInstance(1 << 1)
SetMoveIgnoreMask(1 << 2)

1 Like

Here is how I use it:

FCollisionQueryParams QueryParams;
QueryParams.IgnoreMask = 1 << 3;

Now any sweep/trace that uses QueryParams will ignore any collision that has the MaskFilter = 1 << 3.

So for any primitive component subclasses that I want sweeps to ignore I set:

SetMaskFilterOnBodyInstance(1 << 3);

So If I have a Static Mesh Component, I would do:
Mesh->SetMaskFilterOnBodyInstance(1 << 3);

Now my sweeps/traces that use QueryParams will ignore Mesh.

3 Likes

Can confirm that this does work - HOWEVER - you may need to call UpdatePhysicsFilterData on the Body Instance after setting the mask. That was the case for me, at least.

Does this works with USkeletalMeshComponent instances?

I’m able to use it on a UCapsuleComponent, but not on a skeletal mesh. I’m on UE5.3.2.

Found the solution (credits). For skeletal meshes the required code is more complex:

USkeletalMeshComponent * SkeletalMesh /*= ...*/;
FMaskFilter Mask /*= ...*/;

SkeletalMesh->SetMaskFilterOnBodyInstance(Mask);
if (UPhysicsAsset* PA = SkeletalMesh->GetPhysicsAsset())
{
	for (USkeletalBodySetup * SBS : PA->SkeletalBodySetups)
	{
		SBS->DefaultInstance.SetMaskFilter(Mask);
	}
}