There is a gap in the skirt, how to solve it?
The cloth I created through InitializeFromData() has added motion constraints, but the skirt seems to be stretched, and I don’t know where the problem is; if it is a simple piece of cloth, it will not be stretched without adding a distance constraint; Is it because of the skirt? How to set it up?
The above is what it should look like, The following is what it looks like after I pass in the vertices after the simulation operation, and it is stretched a bit seriously.
Adding tether constraints, or gradually reducing the particle mass at lower parts of the skirt can both help reduce stretching.
Thanks for the answer, I still have a problem here, the dress seems to be torn, there are gaps, how to solve it? Looking at the official document, it may be a constraint problem. The following is my code, including Fabric and Motion constraints. Other constraints are gone, so I don’t know where the problem is. After I remove the Motion constraints and the effect is the same.
nv::cloth::BoundedData positions = nv::cloth::ClothMeshData::ToBoundedData(verticesXYZ);
nv::cloth::BoundedData indices = nv::cloth::ClothMeshData::ToBoundedData(indexs);
ClothMeshData cloth_mesh;
PxVec3 originPoint = PxVec3(originData->x, originData->y, originData->z);
originPoint = PxVec3(0, 0, 0);
PxMat44 transform = PxTransform(originPoint, PxQuat(0, PxVec3(1.f, 0.f, 0.f)));
cloth_mesh.InitializeFromData(positions, indices, transform);
cloth_mesh.AttachClothUsingTopVertices(0.1);
nv::cloth::ClothMeshDesc mesh_desc = cloth_mesh.GetClothMeshDesc();
nv::cloth::Vector<int32_t>::Type phaseTypeInfo;
app.mFabric = NvClothCookFabricFromMesh(factory, mesh_desc, PxVec3(0.0f, -4.f, 0.0f), &phaseTypeInfo, false);
...
// MARK: - Set distance constraints
nv::cloth::Range<physx::PxVec4> distance_constraints = app.cloth->getMotionConstraints();
for (int i = 0; i < (int)distance_constraints.size(); i++) {
distance_constraints[i] = physx::PxVec4(particlesCopy[i].getXYZ(), 0.002f * (i % 800) * 0.002f * (i % 800));
}
Tether constraint scale = 1.0
Tether constraint scale = 0.8
@mtamis-NV When the Tether constraint scale is 0.8 below, the gap can be clearly seen. I guess that the positions and indices passed in by the constraint or cloth_mesh initialization are not enough. The official room is another initialization method.