Deciding which BP actor to destroy when there's multiple

Hey, I have a building system which consists of a set of actors that are placed by the player. These actors has a health setup so when they take any damage and their health is 0 they’re destroyed (spawns a destructible mesh etc.).

The issue I have is that when theres multiple building actors placed next to eachother, its random which actor is destroyed. The target for destroy actor is a self referance; how can I decide with 100% accuracy which actor gets destroyed? Ive looked into object/class arrays to no avail.

Im on my phone, and on vacation so I cant link the BP. Happy holidays!

Cheers!

Hey there, how are you destroying the actors? Doing a trace?

Hey! I’m detecting them with a sphere trace and then Apply Damage. The damaging logic is in the weapon blueprint. For the testing Im doing right now, Im spawning the same blueprint actor (foundations). I bet theres an easy solution to this, but either way I havent experienced this type of behavior before.

Okay I’ll give that a shot once Im home from holidays. I was thinking the same, but I thought the sphere trace was the best approach for my melee system as the guy making a tutorial used it. I m looking at getting a socket-trace along the blade of the sword instead.

A sphere trace might be problematic, because if you have radius from other actors that overlap you might delete the wrong one. Why dont you do a simple line trace to where the player is looking?

Sounds good, let me know how it goes :slight_smile: