x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
Tags:
more ▼

asked Apr 03 '14 at 05:22 PM in C++ Programming

avatar image

BiggestSmile
1.6k 54 38 105

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi BiggestSmile!

It sounds like you're on the right track. Check out this blueprint tutorial video: https://www.youtube.com/watch?v=_NCtcHXJPjg&list=PLZlv_N0_O1gaG5BW72It4chjhypxIO9ZB&index=8

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

more ▼

answered Apr 03 '14 at 06:49 PM

avatar image

User-1420270633 STAFF
968 27 26 58

avatar image BiggestSmile Apr 03 '14 at 07:36 PM

Thanks for a reply :) 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 :)

avatar image User-1420270633 STAFF Apr 04 '14 at 12:04 AM

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

avatar image BiggestSmile Apr 04 '14 at 10:07 AM

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 :) Thanks for the reply, it actually helped. Have a nice day :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question