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"

How to share 1 hit event between 2 objects?

2 equal importance objects collide, and i want to trigger 1 FX (sound+particles) event upon the collision, rather than 2 (one for each as it is now)

the objects are of the same class and importance, so saving the functionality in only one isn't an option.

how would you go for implementing that without hurting the performance badly by saving an array of all collided objects?

These objects collide a lot, and there are tens of them. not only 2.

Product Version: UE 4.21
Tags:
more ▼

asked Apr 08 '19 at 03:49 PM in Blueprint Scripting

avatar image

Arty-McLabin
868 19 41 61

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

2 answers: sort voted first

Came out with an idea. Will hear other options with pleasure.

Possible solution:

  1. Create a dedicated class for the FX, containing both collided objects as variables

  2. Have a function in the colliding objects class, that spawns that FX class

  3. Upon each collision, first check if there is already a FX class instance spawned in some small radius, that contains these objects & were created in the last 0.1 sec or so. if true - don't create a new one. (avoid duplicate)

This way the first one to trigger the hit event will spawn the FX, and the second one will be prevented from doing so.

more ▼

answered Apr 08 '19 at 03:58 PM

avatar image

Arty-McLabin
868 19 41 61

avatar image Arty-McLabin Apr 23 '19 at 02:41 PM

That's the approach i've took in the end. works like a charm. if anybody needs it, ill gladly share details on request.

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

Hello! Was thinking you could also use an Event Dispatcher to talk to the LevelBP and have the LevelBP execute a Spawn Emitter at Location after a DoOnce (Pass the world location of a hit in the Dispatcher). Have also a FlipFlop behind the DoOnce (and after the Dispatcher) that has A wired to the DoOnce's Exec and B wired to the Reset so that the second/superfluous Dispatch resets the Do Once for the next pair of Hits.

more ▼

answered Apr 08 '19 at 05:02 PM

avatar image

duderseb
503 2 9 7

avatar image Arty-McLabin Apr 12 '19 at 02:35 PM

hmm that's actually a nice idea. a DoOnce would be problematic here though because it's global for all calls (will execute for all the calls from all the objects and locations) and not "local" for some specific location or another variable. Would have to implement the logic otherwise, without DoOnce and FlipFlop.

(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