Changing type of a trigger component

Hi,

I’m trying to make a generic targeting system in blueprints. So far I’m putting a sphere collision component on my actor, and I’m tracking targets based on the begin/endOverlap events.

Is there a way to make that sphere collision component abstract ? As in “child classes must have either a box/sphere/capsule collision component” ? My logic will be the same for each of those : use the begin/endOverlap events to track actors in a certain area.

I’m guessing this is possible in c++, but is there a way to do this in blueprints ?

Precisions :

  • I don’t want to have a subclass for each collision shape : that would needlessly duplicate code.
  • I guess I could have 3 variables (one for each shape), and have the user just create and reference whichever shape they want in the level. But I don’t like having to care about an extra object.

Thanks !

In case anyone ever finds this topic, here’s my workaround using triggers :

  1. In your blueprint class, have a public reference to a Trigger Base object.
  2. Add a BeginPlay event in your event graph, and set it as shown on image
  3. In your level, add your blueprint actor and any kind of trigger (sphere/box/capsule)
  4. Set the public reference to the Trigger Base to the trigger in your level.

Not exactly the solution I would have wanted, but it works.