Trigger actor component

Hi there. To make some objects interactive i decided to use trigger volumes to detect if player is near the object.
Currently imagine it like that: object actor has trigger within itself, when character overlaps the trigger, trigger sets corresponding flags so character could interact with the object. Trigger should be actor component, as i understand, so i’ll be able to edit trigger properties inside object blueprint(more like prefab object), within Components tab. I need to override trigger’s Begin/End overlap function to set corresponding flags, i’m able to do that with ATriggerBox/Volume/etc, but i won’t be able to edit it inside blueprint; UShapeComponent has no overlap functions that could be reload. So what would be a solution to this? Maybe there’s even a better way to detect if player is near some specified object available?
Thanks in advance.

Hi BiggestSmile!

It sounds like you’re on the right track. Check out this blueprint tutorial video: - YouTube

In it, they’re using a trigger volume to enable input when the player gets near a light (so that the player can turn on/off the light). Sounds like a good example of what you’re trying to accomplish.

Cheers! - MikeB

Thanks for a reply :slight_smile: I’m actually trying to avoid blueprints for this kind of things and mostly use it for “high-level” scripting. As i’ve mentioned already, i’d like to see some trigger volume as actor component, all the logic behind object would happen in the code; As you suggested, i could use blueprint class based on AInteractiveObject, add UBoxComponent or any other shape component and make the component behave as trigger via blueprint scripting, but as i said, i’m trying to avoid blueprints for such things. Well the task is pretty easy actually, but i can’t mix things together, i’m either able to override overlap functions and write custom logic for it or able to edit trigger properties inside blueprint components(ATriggerVolume/ATriggerBox allows me to override functions, UBoxComponent allows me to edit itself in blueprint components tab). I guess i’m missing something, is there a way to achieve that C+±only way? Thanks once again; i hope i made it little bit more clear now :slight_smile:

Yeah… Blueprints are designed to be easily extended through C++; blueprints are built on a C++ backbone, so pretty much everything you can do in a blueprint you can do in C++.

If we were building this in a blueprint, we would add a BoxComponent to the actor, and then add events for the component’s OnComponentBeginOverlap/OnComponentEndOverlap delegates.

Well, you can do the same thing in C++… Attach a UBoxComponent to your actor, and then bind methods with the component’s OnComponentBeginOverlap/OnComponentEndOverlap delegates (found in the component’s UPrimitiveComponent base class).

Hope this helps… However, I am curious why you’re steering away from blueprints? Blueprints are extremely powerful, and quick to iterate in (even for us programmers).

Cheers - MikeB

Oh, exactly… missed these delegates somehow, just rushed on the idea to overload overlap functions…

About blueprints, i really love them and they’re cool, but i’m trying to keep things as much native as possible. I do use blueprints of course, for prefab objects scripting and level scripting, but i thought it would be better to implement that trigger via code. That may be weird, but that’s how i see these things :slight_smile: Thanks for the reply, it actually helped. Have a nice day :slight_smile: