# Procedural mesh destructible

**URL:** <https://forums.unrealengine.com/t/procedural-mesh-destructible/84861>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [February 9, 2017, 2:09pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861 "2017-02-09T14:09:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EpEp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EpEp](https://forums.unrealengine.com/u/EpEp)\
**Post date:** [February 9, 2017, 2:09pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/1 "2017-02-09T14:09:46Z")

</div>

Id like to know if it would be possible to generate a destructible mesh from a procedural mesh at run time. For example: A box is drawn, using the procedural mesh component, as specified by the player.  
Then when the player clicks a button or something a destructible mesh is generated and replaces the procedural mesh, allowing it to shatter.

If there is a way to do this in C++ but not in BP that’s fine too.

---

<div class="post-metadata">

**Author:** ![Lusiogenic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lusiogenic/32/1054664_2.png) [@Lusiogenic](https://forums.unrealengine.com/u/Lusiogenic)\
**Post date:** [February 13, 2017, 10:32am UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/2 "2017-02-13T10:32:04Z")

</div>

You can do this, if you calculate the fractured meshes yourself probably using a Voronoi algorithm.  
Here’s a tutorial on procedural meshes:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

The fracturing algorithm that exists today in the engine can only be used in editor, not at runtime. They have mentioned that they want to make it so that it would work at runtime in the future, but not sure when.

So you could look at the algorithm already used in the editor and make that work in real time.

But yeah, it’s possible, depending on how much work you want to put in it. If this is a main feature of your game, it’s probably worth it to put in the time. If not, just use the built in way.

---

<div class="post-metadata">

**Author:** ![EpEp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EpEp](https://forums.unrealengine.com/u/EpEp)\
**Post date:** [February 17, 2017, 6:33pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/3 "2017-02-17T18:33:17Z")

</div>

That’s good to hear, could you possibly point me in a direction as to where the fracture code is located?

---

<div class="post-metadata">

**Author:** ![Lusiogenic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lusiogenic/32/1054664_2.png) [@Lusiogenic](https://forums.unrealengine.com/u/Lusiogenic)\
**Post date:** [February 17, 2017, 8:05pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/4 "2017-02-17T20:05:39Z")

</div>

I don’t know exactly where it is.  
Go here and search for ‘fracture’:  
[https://github.com/EpicGames/UnrealEngine/find/release](https://github.com/EpicGames/UnrealEngine/find/release)

Here’s probably the header for an implementation by NVIDIA:  
[https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/ThirdParty/PhysX/APEX\_1.4/shared/internal/include/FractureTools.h](https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/ThirdParty/PhysX/APEX_1.4/shared/internal/include/FractureTools.h)  
Look for the function ‘createVoronoiSplitMesh’.

Yeah, apparently there’s an API from NVIDIA in PhysX:  
[https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/ThirdParty/PhysX/APEX\_1.4/include/destructible/FractureToolsAPI.h](https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/ThirdParty/PhysX/APEX_1.4/include/destructible/FractureToolsAPI.h)

It describes how the function is used.

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [February 17, 2017, 8:27pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/5 "2017-02-17T20:27:01Z")

</div>

> **[\[WIP\] Run-time object fracturing](https://forums.unrealengine.com/showthread.php?130843-WIP-Run-time-object-fracturing&highlight=fracture)**
>
> Hi EU community, A just want to share you my experiments in run-time object fracturing. For now, it just a prototype but I working to make it usable and functional. Feel free to say if you are interested 🙂 I will update the post with...

---

<div class="post-metadata">

**Author:** ![Moddingear](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moddingear](https://forums.unrealengine.com/u/Moddingear)\
**Post date:** [February 17, 2017, 11:19pm UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/6 "2017-02-17T23:19:46Z")

</div>

Use RuntimeMeshComponent (It’s a plugin that does better that ProceduralMesh), transform your PMC into a static mesh using the built in function, and the shatter it.

---

<div class="post-metadata">

**Author:** ![EpEp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EpEp](https://forums.unrealengine.com/u/EpEp)\
**Post date:** [February 18, 2017, 8:41am UTC](https://forums.unrealengine.com/t/procedural-mesh-destructible/84861/7 "2017-02-18T08:41:44Z")

</div>

Thanks for all the help so far!  
I’l go and try to figure out this stuff, but I’m sure I’l be coming back again for some help.
