Cloth not responding to parts of ClothSphereColliderPair.

Just look at the picture:
3114157--235497--upload_2017-6-20_15-5-53.png

The colliders are dynamically generated once based on the bone transforms. And are subdevided using a BVH method. But, when I set up the ClothSphereColliderPair[ ], the right legs colliders always fails.

Here is the code how I setup and pass the ClothSphereColliderPair[ ] to the Cloth component:
First, I already have SphereColliders[ ] colliders generated;

private void CreateColliderPairs()
{
List pair = new List();

for (int i = 0; i < refBonesCount; i++)
{
if (skinnedBVHs != null)
{
int parentId = skinnedBVHs*.bvh.id;*
BVHNode.Traverse(skinnedBVHs*.bvh, (BVHNode node) =>*
{
if (node.id != parentId)
{
if (parentId == thighRIndex)
{
Debug.Log("skinnedBVH is thighR");
}
pair.Add(new ClothSphereColliderPair(colliders[node.id], colliders[parentId]));
}
});
}
}
// If I only add the right legs’ colliders in the hard coded way, it would work.
//pair.Add(new ClothSphereColliderPair(colliders[skinnedBVHs[pelvisIndex].bvh.id], colliders[skinnedBVHs[thighRIndex].bvh.id]));
//pair.Add(new ClothSphereColliderPair(colliders[skinnedBVHs[pelvisIndex].bvh.id], colliders[skinnedBVHs[thighLIndex].bvh.id]));
//pair.Add(new ClothSphereColliderPair(colliders[skinnedBVHs[thighLIndex].bvh.id], colliders[skinnedBVHs[calfLIndex].bvh.id]));
//pair.Add(new ClothSphereColliderPair(colliders[skinnedBVHs[thighRIndex].bvh.id], colliders[skinnedBVHs[calfRIndex].bvh.id]));

colliderPairs = new ClothSphereColliderPair[pair.Count];
pair.CopyTo(colliderPairs);
}
As you can see, the ClothSphereColliderPair is created into a List<>, and then copied to the colliderPairs, which is an array.
And for the case to setup the collider pair to the cloth, simply do Cloth.sphereColliders = colliderPairs;
I thought the Cloth component has a limit of 30 for the sphere collider pairs. Anyway my colliderPairs is definitely less than that.

Were you able to figure this out? I have the same issue

I found this happens when you overlap colliders like I see in your picture. I prefer capsules and I line up the ends like joints. I also add a bit more on my colliders to help and I try not to scale the transform as I thought it was doing odd things to the cloth.

Last thing, I made a robe like that in your picture. It looks like you have a full front. I found it to be a huge pain(with world settings) and the result on my end was subpar compared to a robe with bathrobe type design. I redid all my characters with several styles of that kind of robe. Unity cloth is really great but it doesn’t work well with some designs.

Hopefully that helps you.

1 Like