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?

1 Like

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());
			}
			*/
		}

@Kibblesticks have you tried the method nameLive mention? Does it work?

HasClothData always return false in ue 5.3.1. I use panel cloth editor to construct my clot h asset and put it under the human skeletalmeshcomponent