I have a UProceduralMeshComponent set up to make an AActor cube out of 8 vertices with collision using
mesh->CreateMeshSection(0, vertices, triangles, TArray<FVector>(), TArray<FVector2D>(), TArray<FColor>(), TArray<FProcMeshTangent>(), true);
Then after construction I call (from a plugin) a method to increase the size of the cube by moving out the vertices a set distance, and then update the mesh with
mesh->UpdateMeshSection(0, vertices, TArray<FVector>(), TArray<FVector2D>(), TArray<FColor>(), TArray<FProcMeshTangent>());
This seems to work fine, the cubes can be added to the editor and grown, but in PIE when I push a physics enabled sphere into the geometry, it can enter the cube until it hits the collision of the older, smaller cube as seen in this video: https://youtu.be/fVYYjyzwFxQ
I’ve attached delegates to the OnHit&Overlap methods which just provide some debug output visible in the video. The collision settings (in the AActor constructor) of the mesh are kinda messy because I’ve tried so many options to try and get this to work:
RootComponent = mesh; mesh->OnComponentHit.AddDynamic(this, &AVASFVVolume::OnHit); // delegate, OnComponentHit could be OnComponentOverlap?? Simulate In Editor mesh->OnComponentBeginOverlap.AddDynamic(this, &AVASFVVolume::OnOverlapBegin); mesh->OnComponentEndOverlap.AddDynamic(this, &AVASFVVolume::OnOverlapEnd); mesh->SetNotifyRigidBodyCollision(true); mesh->bGenerateOverlapEvents = false; mesh->SetCollisionProfileName(TEXT("BlockAllDynamic")); // https://docs.unrealengine.com/latest/INT/Engine/Physics/Collision/Reference/index.html ?? mesh->bTraceComplexOnMove = true; //https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/UPrimitiveComponent/bTraceComplexOnMove/index.html // so when moving the object, it uses "complex" collision I think?
I’ve tried calling ClearAllMeshSections() in my ‘update mesh’ method and then CreateMeshSection again, but that seems to have no effect on the problem though.
I’ve tried this in 4.10 and 4.12 and both seem to have the same issue with my code.