Hello, this is how I used your expression to work better on duik rigging.
I lock the controller on the members.
The expression is applied to the controller position.
Thanks to the both of you !
// layers relationships : member C parented to memberB parented to memberA parented to control
memberA=thisComp.layer("cuisse droite");
memberB=thisComp.layer("patte arrière droite");
memberC=thisComp.layer("mollet arrière droite");
control=thisComp.layer("corps");
function getWorldPos(L){
return L.toWorld(L.anchorPoint);
}
distA = length(getWorldPos(memberA),getWorldPos(memberB));
distB = length(getWorldPos(memberB),getWorldPos(memberC));
radius = distA+distB;
// if the anchorPoint of the control layer is no [0,0]
center = memberA.transform.position
-corps.transform.anchorPoint;
position = transform.position;
v = position - center;
length(v) > radius ? center + normalize(v)*radius : value