How to get vertices positions for cloth simulation?

I’m trying to get the vertices positions of a cloth simulation so I can build a procedural mesh from a sim at runtime. Any ideas on how to do this?

Here you go :slight_smile:

You prob need to include several things for the SkeletalMeshLODRenderData etc.

const FSkeletalMeshLODRenderData& skelMeshRenderDataTemp = skelComponent->GetSkeletalMeshRenderData()->LODRenderData[0];
FSkinWeightVertexBuffer& skinWeightBufferTemp = *skelComponent->GetSkinWeightBuffer(0);

		if (skelMeshRenderDataTemp.HasClothData()) {

			// UE_LOG(LogTemp, Warning, TEXT("Has Cloth"));

			
			// Cloth Positions if ever needed
			/*
			auto currentClothingData = skelComponent->GetCurrentClothingData_AnyThread();
			TArray<FClothSimulData> clothSimulData;
			currentClothingData.GenerateValueArray(clothSimulData);

			for (auto simulDataTest : clothSimulData) {

				// simulDataTest.Positions
				// simulDataTest.Normals

				for (auto simulDataPosTest : simulDataTest.Positions)
					UE_LOG(LogTemp, Warning, TEXT("pos: %s"), *simulDataPosTest.ToString());
			}
			*/
		}