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"

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: https://www.youtube.com/watch?v=fNK1qz2h5V0&lc

or this: https://www.youtube.com/watch?v=C-ak07xzZt8

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.

Product Version: UE 4.18
Tags:
more ▼

asked Nov 13 '17 at 05:50 PM in Blueprint Scripting

avatar image

Rutran
3 1 2 3

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

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"

alt text

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

alt text

5) Place the DestructibleWall actor inside the level. Play and shoot at it. It should change mesh from "Wall_400x400" to "Wall_Door_400x400"

alt text alt text

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.

destroywall.png (219.2 kB)
projectile.png (217.2 kB)
before.png (795.1 kB)
after.png (828.3 kB)
more ▼

answered Nov 14 '17 at 05:23 AM

avatar image

SHOBBIT
650 12 13 27

(comments are locked)
10|2000 characters needed characters left

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

https://m.youtube.com/watch?v=T6xBisajR7c

more ▼

answered Nov 13 '17 at 06:19 PM

avatar image

SHOBBIT
650 12 13 27

avatar image Rutran Nov 13 '17 at 07:01 PM

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: http://battlefield.wikia.com/wiki/Destruction "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).

avatar image SHOBBIT Nov 13 '17 at 07:08 PM

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

avatar image Rutran Nov 13 '17 at 07:14 PM

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. :)

Edit - In final stage I want to make it look like this: https://www.youtube.com/watch?v=7vwiT1G9350

(comments are locked)
10|2000 characters needed characters left

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.

https://www.youtube.com/watch?v=SntKdBKK9TA&feature=youtu.be

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 -

alt text

4) Then this -

alt text

5) Then this -

alt text

6) Then this -

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

alt text

7) Inside the Event Graph Right click on the Hit on the OnComponentHit node and Select "Split Struct Pin"

8) Then copy this script- alt text

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

one.png (306.7 kB)
two.png (308.4 kB)
three.png (320.3 kB)
four.png (326.9 kB)
six.png (136.3 kB)
more ▼

answered Nov 14 '17 at 07:36 AM

avatar image

SHOBBIT
650 12 13 27

avatar image Rutran Nov 14 '17 at 01:46 PM

It works! I really appreciate your help, now I got the "core" of building destruction. :) 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!

avatar image SHOBBIT Nov 14 '17 at 02:19 PM

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.

https://www.youtube.com/watch?v=w4XlBKeE46E&list=PLV32aR_4dpyPZaiYzJNKHMA-eCeAuyR6J

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

avatar image Rutran Nov 14 '17 at 02:48 PM

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?

(comments are locked)
10|2000 characters needed characters left
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