Destructible Projectile

I know this is a complete beginner question, I haven’t been digging into BP’s that much.

The projectile ball on the FPS starter gun- I want to make that break apart using the destruct system when it collides with something. The actors break apart, I want the ball too. Imagine if you were throwing a ball made of ice at something.

I tried fiddling with it and broke a few things, I assume this is fairly simple to do.

Thanks!

Need a projectile, A particle and an impulse i guess.

I have that much- I don’t know what nodes I need in the event graph or if there are other settings on the projectile (static mesh) I need to enable in the details panel?

Hi TimeSpirit,

There are probably a couple of ways you could go about doing something like this.

I have not personally tested this but this would be how I would start looking into it. There may be other things you’ll need to test and organize to get it just right though.

In the projectile you can add a Destructible version of your mesh. Check the box beside generate hit events.

In the event graph you’ll want to pull a pin out from Hit Location and and get relative then use set Destructible Mesh. Leave the box that says “New Mesh” at the bottom blank. This will instantly cause a crash if anything is selected. This will be fixed in 4.5. This shouldn’t need to be set though.

Give this a shot and start from there. This should be enough to get you started with a DM spawning, hopefully at the hit location for the projectile.

Alternatively, you could always have a simple particle emitter or decal that spawns where the projectile hits and have the projectile destroy itself instantly.

Either of these methods should work for what you’ve described. :slight_smile:

Tim

Thanks Tim!

I’ve been searching through every node- I’m not entirely clear on what “get relative” is. I couldn’t find anything in the docs about or in the BP search. Here is my BP, I’ve added the destructible mesh to the projectile, I checked “Simulation Generates Hit Events”. I know Set Destructible Mesh isn’t doing anything right now, I assume it links to the “Hit” connector on the Event Hit, I’m not sure how.

Well like a monkey using BP’s if you connect enough nodes you’ll eventually get it working! Doesn’t look pretty but does exactly what I want.

I added an impulse like DieByZero had said and spawned it. I don’t even know if the Set Destructible Mesh is needed in this?

It also doesn’t always destroy when hitting the landscape? I left the window running for 10 minutes, came back and then it started working. But if I do a fresh run, the projectile will bounce off the ground instead of exploding.

I must have done something horrible- it works most of the time, but after a few fires it crashes everything. Sometimes I can even fire 20-30 times (not all at once) before it crashes.

*Assertion failed: MyComp [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.4\Engine\Source\Runtime\Engine\Private\Actor.cpp] [Line: 1785]
*

Tried a whole number of things- everything from the mesh details to changing the materials. Another oddity that happens, if I smash it close to the player, after coming to rest, the destroyed pieces don’t fade out and instead fly up into the air. If I fire this a few feet out from the player, that doesn’t happen and works as expected.

First thing you should do is remove the execution loop and the do once. Just make it go Apply Damage -> Destroy Component -> Fire Impulse.

What you are doing is not what you explained in your first post though. What you should be seeing is just the ball disapearing as you are just removing the static mesh component when it hits something. This simply makes the ball invisible. The actor itself is probably still there just not visible. Instead you probably want to do Apply Damage -> Fire Impulse -> Destroy Actor. Where destroy actor is self.

This will still just have the ball dispear though so you want to add the breaking apart effect to this before doing the fire immpulse (I am asuming the fire impulse is suposed to send the parts of the ball flying).