Joint Stretching Problem


Hi Guys, I have a problem with Stretching of Joints. As you can see, when the controller moving and the joints seems to be like dragged.
I have added the scripts into expression editor and it looks like this:

$ref_length = distanceDimensionShape1.distance + distanceDimensionShape2.distance;
$ik_length = IK_distanceDimensionShape.distance;
if($ik_length >= $ref_length){
ik_jnt2.scaleX = $ik_length/$ref_length;
ik_jnt2.scaleX = 1;

I put the scripts into another joints as well.
is there anyone could help me? Thanks


What is the question?
It is quite dificult to tell without knowing what is what in the scene.

I would not do it with expressions, it is way better to use maya utility nodes, in this case a condition node for the if/else statement and multiply/divide nodes for the scaling factor.
To put this expression on other limbs you need to make copies of it and replace the names.