Set collision masks on Blueprints?

Basically I want to be able to set different collision masks for different objects during runtime. In my current example/prototype I am trying to make 4 of my 8 boxes collide with each other (and BSPs) while these 4 do not collide with the other 4 boxes, and vice versa.

Is this possible? It is important that I can change the layer masks during runtime.

In Unity this would be physics layer masks.

Unreal Engine has collision filtering under Project Settings → Engine - Collision

It should work more or less the same way.

The problem is to do this during runtime.

I found something that may work but there is very little to go on at this point. I’m hoping others may take this lead and figure out how to use it. I found these functions in “PrimitiveComponent.h”.

	/** Set the mask filter we use when moving. */
	void SetMoveIgnoreMask(FMaskFilter InMoveIgnoreMask);

	/** Get the mask filter we use when moving. */
	FMaskFilter GetMoveIgnoreMask() const { return MoveIgnoreMask; }

	/** Set the mask filter checked when others move into us. */
	void SetMaskFilterOnBodyInstance(FMaskFilter InMaskFilter) { BodyInstance.SetMaskFilter(InMaskFilter); }

	/** Get the mask filter checked when others move into us. */
	FMaskFilter GetMaskFilterOnBodyInstance(FMaskFilter InMaskFilter) const { return BodyInstance.GetMaskFilter(); }

There are also some functions that let you provide a list of actors to ignore.

	/**
	 * Tells this component whether to ignore collision with all components of a specific Actor when this component is moved.
	 * Components on the other Actor may also need to be told to do the same when they move.
	 * Does not affect movement of this component when simulating physics.
	 */
	UFUNCTION(BlueprintCallable, Category = "Collision", meta=(Keywords="Move MoveIgnore"))
	void IgnoreActorWhenMoving(AActor* Actor, bool bShouldIgnore);

And some others that let you do it on a component level. I need the mask method, personally.

I will update this answer if I figure it out. For now that’s the best I can do.

UPDATE:

I was able to use IgnoreActorWhenMoving(). It does what it says. If that’s enough for you then this is your answer already. I need to ignore a whole category of actors but I can’t use collision channels, so I’m moving on to ignoring by mask (whatever that is).