Hee hee! I was hoping you’d ask
The obvious solution of creating physics constraints, connecting all of the meshes is what I tried first.
So I picked one mesh to be the root, and all others were supplied as the second component to the constraint.
So for 5 meshes this meant 4 constraints.
But for larger numbers of meshes, anything above 3 actually, I was getting a lot of wobbling.
As I was using my in-game editor to create the constraints, I accidentally started repeatedly doing the above process to each of the other 4 meshes, making each of them the root as well, and the result was increasing stability!
So I discovered the solution by accident:
Using the general format:
//Create new constraint
//~~~ Init Constraint ~~~
ConstraintComp->SetConstrainedComponents(RootSMA->StaticMeshComponent, NAME_None, TargetSMA->StaticMeshComponent,NAME_None);
I cycle through all the meshes and each one gets its turn to be the root, and all other meshes are linked to the root.
So this means that for 5 meshes there are actually 5 x 4 physics constraints being created, because I don't link the root to itself :)
This removes all wobbling and causes the boundary meshes of the shape to correctly bounce against terrain, causing all the other meshes to respond perfectly :)
1. Using LCM and ACM_Locked
2. The distance for LCM is the measured distance between the meshes that are being joined by a constraint
3. Every mesh is given its turn to be the root and all other meshes are joined to it
On my machine, I start to get some fps lag after about 10 physics kinetic combinations are made that each have around 20-ish meshes each.
So this means 10 x 20 x 19 = 3,800 total physics constraints
For my game purpose of giving the user the ability to generate their own physics combinations,
and then romp around on them,
and have those physics combinations intereact with each other, ~4,000 constraints is perfectly reasonable!
UE4 Physics Engine is Awesome!