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"

Activate different Actors with Line Trace

The basic idea has been brought up before: cast a Trace Line and have the Hit actor react (open menu, higlight, etc.). What I do is use a Cast To "name_of_Static_Mesh" but in this case I can't have the same trace be cast on multiple objects. I tried using "Cast To Actor" but that doesn't seem to work either. The main issue with Cast To at this point is that I need a "Custom Event" that can reference and affect all the objects on a list independent of each other (based on Hit Actor). I tried using an event on Level Blueprint but I'm not sure how that can help me. alt text alt text

Is there a way to have an event trigger when a line trace hits an actor that isn't limited to one object and that changes based on what is being hit by the line trace? I just need a reusable event that can be put on all objects, if it is possible.

Product Version: UE 4.9
more ▼

asked Sep 12 '15 at 11:36 AM in Blueprint Scripting

avatar image

8 3 4 7

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

1 answer: sort voted first

Well there are pretty major concepts based around exactly this functionality.

The most used one if you really need exactly the same functionality with maybe slightly different variables is inheritance.

You create one master class at the very top which contains this functionality and then create or reparent your current bps to that one. Basically you don't use "Actor" as your parent class anymore but "" which by itself is a child of actor.

Like this everything will have this functionality. If you make it depended on a variable you can change the default value of it in the child classes or make it change via some event or whatever.

Here's a basic overview about this in the docs: https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprints_Advanced/2_5/index.html

If it's not the same behavior every time your best bet would be a interface. The details are explained here: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html

But what it is after all is a function you can implement in your blueprint class which will be called. You can check from your trace if actor is implementing the interface and then call the interface function while defining the functionality in that function in every actor separately.

I hope this helps already. Otherwise just ask away!


more ▼

answered Sep 12 '15 at 02:57 PM

avatar image

5.9k 291 86 293

avatar image NOTO Sep 13 '15 at 02:13 AM

Yep, that did it. Actually this whole concept of BP Interface concept kept eluding me until now. I'll try to post a relevant example with what I got for further reference although the documentation in the links should be enough for just about anything.

Thanks and cheers!

(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