How to setup an actor to collide with a specific subset of players?

I’m trying to implement a kind of “energy fence” object that lets players of one team through while blocking players of the other teams (I have more than two teams). Is there a way to dynamically create collision groups or setup the object to ignore collisions with specific actors?

I ended up using Pawn “Ignore Actor When Moving” function on my player characters to prevent them from getting blocked by the object when moving.