Procedural mesh destructible

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.

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

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.

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

I don’t know exactly where it is.
Go here and search for ‘fracture’:
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
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

It describes how the function is used.

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.

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.