How to replace one mesh with another mesh?

Hello,

I’m trying to figure out how to replace 1st mesh (wall1) with 2nd mesh (wall2) in Blueprints.

From what I know if I have two mesh components. I have to show one (wall1) on start. Then on hit, show the other (wall2) and hide the first (wall1).

I’m trying to make something similar to this below:

or this:

Maybe someone can explain how to make this “destruction system” from this video?

I’m just a rookie when it comes to UE4 and BP but I really want to learn this great engine.

1 Like

Well to change a static mesh you simply drag out static mesh component in your blueprint actor and set static mesh to whatever you want. You can trigger the function via an Event like in the video below. For the effect you simply spawn emitter at location. However, rather than changing it, for a high quality game. How about this

Well I will help you just cannot explain right now as I am no where near my PC. Hopefully someone else will jump in before me. If not, I will definetly help you in the next 12 hours. Verbally, it would take me too long to type it all. I hope you undetstand. But basically, it will happen as explained

to change a static mesh you simply drag out static mesh component in your blueprint actor and set static mesh to whatever you want. You can trigger this as a function via an Event hit from projectile like in the video. For the effect you simply spawn emitter at location.

Offcourse, this is a very coarse way to put it.

Edit - It is obvious that you will need two meshes. One without hole and one with hole

Thank you for your answer.

I know how to make Destructible Meshes with PhysX (I watched a couple of tutorials) and it looks incredible but the main reason I want to make “scripted” destruction is because PhysX will not performance well in a multiplayer game.

My target is to make destruction the way it is done in Battlefield Bad Company 1 and Bad Company 2 (scripted destruction).

Quote about the destruction in Battlefield Bad Company 2 from: Destruction | Battlefield Wiki | Fandom
“Destroy a part, the wall disappears behind a smoke particle and is replaced by a hole.”

I need to figure out how to replace 1st mesh (wall) on a 2nd mesh (wall with a hole).

I need to know how to make this in Blueprints:
start with wall (mesh1) → shoot wall (mesh1) by a “yellow ball” → wall (mesh1) hitted by a “yellow ball” is replaced by wall with a hole (mesh2).

I’ll be thankful for a “tutorial” on how to make it with pictures. I’ll be waiting on your help without a doubt, take your time. :slight_smile:

Edit - In final stage I want to make it look like this: battlefield bad company Destruction demo - YouTube

Ah! Much simpler than typing on a phone :smiley:

So, here is what you need to do

  1. Make a 1st person shooter template. Include Starter Content.

  2. Create A new blueprint Actor called “DestructibleWall” by Right Mouse Click → Blueprint Class → Actor

  3. Open that blueprint add a static mesh component under components tab and set the mesh to “Wall_400x400” and then, add a new function. I named mine “DestroyWall”

  4. Add the following script inside “DestroyWall”

  1. Open the “FirstPersonProjectile” BP inside Content → FirstPersonBP

  2. Go To the event graph of this blueprint and detach the event hit from what it is attached to and make the script as below

  1. Place the DestructibleWall actor inside the level. Play and shoot at it. It should change mesh from “Wall_400x400” to “Wall_Door_400x400”

Of course, you can spawn whatever particle effect you want inside the wall BP to make it look like rubble is flying.
Best of luck.

EDIT - The Video you posted. I am pretty sure that would only be possible with using dynamic destruction
and physics enabled objects rather than a “Scripted Destruction” as you said.

1 Like

EDIT - 2

You just sparked a little bit of interest in me and I pondered upon a better way of doing the above procedure which is performance friendly and much more flexible.

What you can do is use Instanced Static Meshes in order to achieve this with Big Buildings with a huge number of walls. Ignore the mouse cursor.

To Achieve what I showed in the video do the following -

  1. Inside the “DestructibleWall” blueprint. Delete the DestroyWall Function and Static Mesh component.

  2. Add two Instaced Static Mesh components they should be named by default as InstancedStaticMesh and InstancedStaticMesh1.

  3. Do this -

  1. Then this -

  1. Then this -

  1. Then this -

Please Note IT is InstancedStaticMesh rather than InstancedStaticMesh1 as in the image

  1. Inside the Event Graph Right click on the Hit on the OnComponentHit node and Select “Split Struct Pin”

  2. Then copy this script-

Oh and Yeah don’t forget to remove the “DestroyWall” Function call inside the Projectile BP

Now you can make entire buildings with destructible Walls. Cheers! If you found this useful please accept my answer. I need that karma. I do deserve it :smiley:

It works! I really appreciate your help, now I got the “core” of building destruction. :slight_smile:
I just gotta ask you, if I import 2 meshes from Blender (wall and wall with a hole) into my UE4 project it will work the same way?

About the Battlefield Bad Company destruction they’ve definetly did it the same way you showed in your tutorial. The wall is replaced by a wall with a hole but in Battlefield it is accompanied by: dust, explosion and flying debris that mask the whole process of replacing meshes. In final result it looks very convincing.

Altrough in Battlefield flying debris looks like they are physics based (enabled) because they fly to the ground and stay there for few seconds. I’m curious is it possible in UE4 to add (first import debris from Blender) flying debris that are physics (gravity?) based.

Thank you Shobhitthackar for all your help and all your work, you’re a genius!

Yes,

Everything is possible with Unreal engine 4. It is simply so powerful yet so simple to learn compared to other game engines and use it is unfathomable. You could with the given assets probably clone the entire game mechanics via blueprints.

Particle effects can simulate physics and you can even set the duration for them to be in the level. You can create a particle effect which simulates debris flying from the blast and have them simulate physics along with some dust.

And yes, importing any mesh will work the same way. But, you have to be careful with the dimensions and UV’s of the mesh as a mismatch would look weird.

You should explore the “Content Examples” Project in the “Learn” tab of the launcher. You can learn about many things from that. Also, Epic Games has awesome beginner tutorials covering everything.

This playlist really helped me countless times. You should check it out.

Thank you very much for all the help!

I’ll definetly check out these Epic Games tutorials! Cheers!

Edit - one last question, it will work with Third Person template?