Programmatically creating geometry collection from static mesh

Hello,

I plan to make use of UE5’s Chaos, and each static mesh requires a geometry collection/fracture. Would it be possible to programmatically create these (ie, I have a mesh component, and from there, I create something that is assigned to a geometry collection component), or does it have to be done manually?

As of right now, I have a blueprint with a static mesh that allows me to pick up/throw objects. When a break event occurs, it removes the mesh actor and spawns a corresponding geo collection actor, that has its geo component pointing to the right geo/fracture. Rather than having to do this for each mesh, it would be great to do it systematically! If my current approach is off, please let me know too :slight_smile:

Thank you

1 Like

I don’t know if you can modify static mesh, it has to become dynamic.
Maybe Dynamic Mesh 3, I’m getting into it, you can use UStaticMeshComponent with it I think but also PMC.
So either of these two in combination with Dynamic Mesh 3.
Simply to modify data you have to load the vertexes from the mesh into a variable system or an array and from there it will flow as "Dynamic"to some component that is alive to read the vertex data that it is getting

PMC is pretty good too, you can then save it as a static mesh, convert from Dynamic to Static. You can fracture it with noise if that is what you want.
Don’t expect PMC to be accurate unless you modify vertex by vertex manually, then you got noise that will offset things for you in an area you like but what I see is that it’s not vertex by vertex when automating things with noise for a whole area, noise pulls on multiple vertexes from an area, as in you cannot displace only the vertex points that you like and others near it will be affected, this is for modifing a mesh in a more automatic way.

Same challenge here. I want to create geometry collections for a couple of asteroids. At some point, the asteroid meshes will be created procedurally and I want to set up geometry collections in Blueprint or C++ for all of them, including a fracture. No clue how to go about that.

Have you found any solutions yet. Would be a blessing if you do

I concluded that this is simply not the intended use of geometry collections and fractures. They are meant to be created in the editor and baked.

I am using the RealtimeMeshComponent free marketplace plugin now. It allows me to procedurally generate asteroids and I even wrote code to split an asteroid in half - at runtime. The splitting requires to do all the math by yourself, though. I.e. decide for every vertex where it goes.

1 Like

Thanks for the reply. I’ll try it and see how it goes.