How to replace one mesh with another mesh?
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: https://www.youtube.com/watch?v=fNK1qz2h5V0&lc
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.
asked Nov 13 '17 at 05:50 PM in Blueprint Scripting
Ah! Much simpler than typing on a phone :D
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"
3) Open the "FirstPersonProjectile" BP inside Content -> FirstPersonBP
4) 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
5) 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.
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
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 -
4) Then this -
5) Then this -
6) Then this -
Please Note IT is InstancedStaticMesh rather than InstancedStaticMesh1 as in the image
7) Inside the Event Graph Right click on the Hit on the OnComponentHit node and Select "Split Struct Pin"
8) 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 :D
Follow this question
Once you sign in you will be able to subscribe for any updates here