I would like to combine multiple GeometryCollection (GC) assets at runtime to simulate as one body. My understanding is that UClusterUnionComponent supports this.
The GCs I’m using were built within the UE 5.4.4 editor and then saved. At runtime I then spawn a UClusterUnionComponent and call AddComponentToCluster and pass a pointer to a GC I spawned form the saved asset. For the other params, I pass an empty TArray for BoneIds (or just a zero in that array also seems to work) and bRebuildGeometry is set to true.
This sort of works in that I end up with a CU in the scene and the two GCs are rigidly constrained to each other. If I turn on debug drawing of the particle connections though, I only see a square dot at the center of each GC. If I show the grandchildren I see the normal GC connections and strain values are correct. My main issue is that there is no strain-based edge / connection between the two root particles of the GCs in the CU. I think this is the cause of the issue where fields don’t seem to affect the CU. I have no trouble with fields when placing the GC assets in the scene directly. The CU GCs also break if they hit the floor, but it seems like each GC breaks in an ‘all or nothing’ fashion (individual GCs don’t break from each other first).
If instead I create a GC in the editor with two Static Meshes that are next to each other, fracture, save and load that in a scene, I do see a connection between the two SM root particles. If I carefully hit this GC with a field, I can just break that first connection and the two items separate. This is the type of effect I was hoping to reproduce using CU and separate GCs added to the CU at runtime.
I must be missing how to add edges to the CU for the root particles. The video I posted talks about using a Connectivity Graph to define the connected elements. I also added the Gameplay Graph plugin, but that just seems to provide a Graph implementation for tracking connections (which is helpful), but I don’t know how to add additional edges to the CU. I would really appreciate someone pointing me in the right direction!
Progress update: I changed the GC Cluster Connectoin Type to Chaos Point Implicit and made sure that when I added two GCs to make sure they were ‘watertight’. Then I actually see green edges (debug drawing) between the root GC particles in the CU.
But, applying a field still has no effect on the CU. The CU seems to ignore both transient and master fields, but standalone GCs right next to the CU explode when the field is applied. I will have to investigate further and would really appreciate any ideas
Regarding connecting geometry collections together you can also use the Cluster Group Index system
Just set the value of the cluster group index of both GC to the same non zero number and they should initialized as one cluster union on the physics thread internally ( all handled transparently )
But if you want more gameplay control, the Cluster Union Component is the way to go effectively, so I’m glad you managed to solve the issues
Regarding fields, I’d have to check how we support fields with cluster unions
One workaround would be to leverage the blueprint nodes to affect geometry collection component ( like ApplyExternalStrain or CrumbleCluster nodes for example ) they should work fine when geometry collections are within a cluster union
Hi CedUE, Thank you very much for your response and the info. I haven’t tried out the Cluster Group Index system so will look into that. I did have some more luck with fields. It seems if I have multiple GCs in a CU and only pass in the root bone for each GC (zero), then the field applying strain doesn’t seem to have an effect. If I pass in a subset of the child bones as well as the root, then the field does have an effect. I am not really sure why this is the case.
This may have something to do with the particular logic that deals with cluster unions in the RigidClustering system
But I’m glad you are able to go around this potential issue