I was noticing that the collision mesh was lagging behind when changed dynamically, I originally thought it was the cooking time as it returns automatically if already cooking a previous change. However after a little experimentation the problem was solved by making the change below. Now the collision generates correctly after updates to the procedural mesh and I haven’t noticed any errors because of it so far.
From:
void UGeneratedMeshComponent::UpdateCollision() {
if (bPhysicsStateCreated) {
DestroyPhysicsState();
UpdateBodySetup();
** CreatePhysicsState();**
ModelBodySetup->InvalidatePhysicsData();
ModelBodySetup->CreatePhysicsMeshes();
}
}
To:
void UGeneratedMeshComponent::UpdateCollision() {
if (bPhysicsStateCreated) {
DestroyPhysicsState();
UpdateBodySetup();
ModelBodySetup->InvalidatePhysicsData();
ModelBodySetup->CreatePhysicsMeshes();
** CreatePhysicsState();**
}
}