How to create collision information for procedural geometry?

Thank you for your response, Michael. Unfortunately, the geometry I am hoping to use comes from applying marching cubes to a signed distance volume which is modified at runtime, which I think would be very very difficult to approximate with simple shapes. I really am hoping to be able to use a triangle mesh to capture the polygon-soup nature of my geometry. I don’t need to re-mesh every frame, and due to the nature of marching cubes can easily break my geometry down into individual chunks which could be re-meshed on demand.

It looks like the most important function for generating PxTriangleMesh instances is FDerivedDataPhysXCooker::BuildTriMesh(…), a private method on an editor-only class. I decided to try to replicate the behavior of this method. I’ve found that if I call GetTargetPlatformManager()->FindPhysXFormat(“PhysXPC”) (or use FPlatformProperties::GetPhysicsFormat()), that I am able to get a pointer to an IPhysXFormat instance, which provides access to CookTriMesh(…) (and also CookConvex(…)). I copied the body of the FDerivedDataPhysXCooker::Build(…) method and modified it to manually cook triangle meshes from my procedural mesh information, and placed the result into the CookedFormatData field of my UBodySetup instance. I found that if I do this, set the UBodySetup::bHasCookedCollisionData field to true, and call UBodySetup::CreatePhysicsMeshes(), the TriMesh and TriMeshNegX fields become populated with valid pointers. Unfortunately, objects in my world do not seem to be colliding with my procedural meshes.

Does anyone have any tips as to where I should look to figure out how to convince the Unreal Engine to “refresh” the physics or collision information of my objects once I have updated my UBodySetup? When I look at the bodies of functions like SetActorEnableCollision(…), there seems to be some additional work needed to tell the engine that the collision geometry of the actor has changed, but I’m having difficulty navigating all the myriad flags and states involved in setting this up.

As before, a preemptive thank you to anyone who can provide any information.