Hello,
I am using UE version 5.5. I followed the tutorial from gradientspace here https://www.gradientspace.com/tutorials/2020/10/23/runtime-mesh-generation-in-ue426 and created a simple Actor derived from ADynamicMeshActor.
I think I managed to create a proper FDynamicMesh3 object, using spheres with coordinates obtained from a PDB entry from the PDB database site https://www.rcsb.org/
According to the log produced by my Actor, the mesh seems properly constructed, but it never gets updated in the view from the Editor (nor when I try to run the code in Game mode).
I have created a test project on GitHub here : https://github.com/c4chris/PMPDBV
The function that tries to get the mesh updated for the Actor is in the file Source/PMPDBV/Private/GrabableDynamicMeshActor.cpp
and reads :
void AGrabableDynamicMeshActor::UpdateMesh(UE::Geometry::FDynamicMesh3& mesh) {
mesh.EnableAttributes();
UE::Geometry::FMeshNormals::InitializeOverlayToPerVertexNormals(mesh.Attributes()->PrimaryNormals(), false);
SourceMesh = mesh;
auto dmc = GetDynamicMeshComponent();
if (dmc) {
*(dmc->GetMesh()) = SourceMesh;
dmc->NotifyMeshUpdated();
// update material on new section
UMaterialInterface* UseMaterial = (dmc->GetMaterial(0) != nullptr) ? dmc->GetMaterial(0) : UMaterial::GetDefaultMaterial(MD_Surface);
dmc->SetMaterial(0, UseMaterial);
UE_LOG(LogPMPDBV, Log, TEXT("AGrabableDynamicMeshActor UpdateMesh succeeded"));
} else {
UE_LOG(LogPMPDBV, Warning, TEXT("AGrabableDynamicMeshActor UpdateMesh No Dynamic Mesh Component"));
}
}
The initial dynamic mesh I create with 3 small spheres of 3 different colors is displayed correctly, but the subsequent spheres added from the PDB entry never show up in the display, and I cannot figure out why
I would be very grateful for any hints of things to try
Kind regards,
Christian