Strange twisting from multi-chain armature 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.
The problem is 3 chains per hair strand combined with that you skipped many segments an created long bones over them, so the bones cannot follow the mesh strand exactly. They try their best to fit the shape, but this results in twisting at the tip:



The 2 side chains are redundant. Build only 1 chain but for every segment and set the bones like this so they rotate with the mesh:



You cannot notice any folding in the strands anyway, you will hardly see any difference.

If you really want to copy the motion exactly, rather than setting up 3 chains for each strand segmented like crazy write a script that will generate disconnected bones on every face and constrain each to that particular face with a Child Of with vertex group of that face. Child Of Constraint Set Inverse with Python

Also this simulation is not very high quality, the mesh oscillates with high frequency and you can see some nasty artifacts (but that does not cause the problem)

In the armature modifier check Preserve Volume (that does Quaternion skinning which you want)