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"

Detect when any destructible mesh destructs in level blueprint

Hello everyone,

I'm putting a large amount of destructible meshes in my level, and want to detect when they are broken and then playing a sound at that location.

One way I could do this is through blueprints, by making every destructible mesh a blueprint and using the OnDestructed function.

However, since there is so many DMs in my level, changing them all into blueprints would be quite laggy. I know I can do this through the Level Blueprint as well, (by having it selected in the map, right clicking in the level blueprint and then creating a reference with an OnDestroyed node) but again, since I have so many that is a waste.

What I want to do is detect if any of them break and it to give me the location/ reference of the destroyed mesh. For example, if I created a DM of a tree, and I put three copies, I want an event to fire every time any of the tree breaks and then to give me a reference of that destroyed DM.

How is this done?

Product Version: UE 4.9
Tags:
more ▼

asked Sep 04 '15 at 09:43 PM in Blueprint Scripting

avatar image

ShrewGlue
444 99 84 108

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

2 answers: sort voted first

The simplest way would be to do a getAllActorsOfClass or GetallActorsWithInterface or getAllActorsWithTag that all have destructable, I would have all destructable actors inherit from a single base BP_destructableMesh class so that you can do a getallActorsOfClass(BP_DestructableMesh) and it will create an array.

Then theres a few ways you could go, such as creating a SetTimer function that calls a function say every 2s (although with 4.9's new tick rate setup you might be able to do something funky and unique) that checks if the length of the array has down down (aka actors got destroyed, aka DestroyActor)

A combination of that, maybe some blueprint interfaces, merging meshes/actors, would be your best bet without having to get into c++ since working with LOTS of actors can be so heavy with BP only as I'm sure you know.... you can get about 10-20x more destructable meshes when using C++ for their logic rather htan blueprints for the same framerate,

Let me know if this helps at all.

Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going as well as keeping answerhub clean so that it gets removed from the "unanswered questions" catagory.

more ▼

answered Sep 04 '15 at 11:45 PM

avatar image

Nsomnia
1.8k 67 27 137

avatar image ShrewGlue Sep 05 '15 at 01:09 AM

I'll try a few things out and update with what I end up doing!

avatar image ShrewGlue Sep 05 '15 at 06:39 PM

Here's my solution:

alt text

capture.png (186.0 kB)
avatar image Nsomnia Sep 05 '15 at 08:55 PM

Yeah I was going to suggets next an event dispatcher! Glad you got it fdigured out.

(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