I am making a rig that transfers motion from one mesh to another via bones. This is for complex mesh hair strands. The base mesh has a cloth sim on it. Chains of bones are constrained to follow this mesh. Another version of the mesh is then driven by this bone armature.
It works by IK constraining the tips of bones to vertices. Their roots are locked by being Connected to the bones high up the chain. Each strand has 5 vertical loops. There are 3 bone chains per strand, on the edge and center loops.
This picture shows the armature and the mesh it is driving, but not the mesh the armature is constrained to.
All areas of this rig are working, but I am getting strange behavior in some parts. In some areas, mostly at the tips, there is twisting in the mesh being controlled by the armature. It appears to be twisted by 180 degrees. Currently, I can solve it by manually selected the three bones that converge at the tip, and then rotating them by 180 degrees on their local Y.
I would like to remove this twisting. I do not understand where it could be coming from. Inherit rotation is disabled on all bones. I've tried changing the bone's rotation mode off Quaternion, but it makes no difference. This rig works entirely by copying location, not rotation, so I do not see how there could actually be any rotation data on the bones (there is none to reset.) Removing weights from the side bones does not help. I can only conclude that the bones are fine, but the mesh is somehow flipping? What could cause this?
EDIT: Here's a link to the file. It's a .zip because it also contains the .mdd needed for it. Apparently those cannot be packed into the blend file. Load it into the Mesh Cache modifier.
https://www.dropbox.com/s/ki3slubwrpb1j9r/HairRigTwistingProblem.zip?dl=0
EDIT 2: I have found a workaround. If I make a vertex group of the loop that runs horizontal across the tail that is at the top of the last bones in the chains, and give them copy rotation to that vertex group, it seems to fix the problem. I may have to pursue this workaround as the full solution, but it does not explain what's going on in the first place.