What you’re after is a combination of Collision Channels
and Object Types
. See those entries for details:
https://www.unrealengine.com/en-US/blog/collision-filtering
Note that you can add your own custom channels / objects types if the defaults are not enough - as they are often not: