# mechanic rig problem: limit distance not working as i want

i think this gif shows how it should work:

The green head should only move on x axis, the green tail should only move on z axis.

I wanna move the "mover" bone, the rest should react.

Unfortunately i am still a noob in mechanical rigging.

I tried it with limit distance constraint and two armatures and a track to constraint like this:

How can i make this work correctly?

In this kind of rigs I generally use drivers and maths (simple Pythagoras theorem).

You can copy the Hypothenuse lenght in edit mode, and paste this value into the driver expression.

Hypotenuse bone is child of the mover bone and has a damped track constraint targeting the affected bone.

Mover bone has a limit location constraint to prevent square root of negative values.

Affected bone has to be set at 0,0,0 loc in rest pose, as the driver result is expressed as an absolute world related value.

• A better expression: sqrt(abs(2.23607**2 - (2-var)**2)) Jan 7, 2022 at 10:59
• i put the mover in rest position to 0 too ...so my formula works without the 2-var, just var ;) and it was less confusing to me. Jan 8, 2022 at 5:59

You could also use a stretch bone and an IK constraint to solve this:

Just set the IK Stretch of the "upper sliding" bone to 1 and lock the X, Y and Z movement.

• +1 very nice, that's the easiest solution by far. Sep 1, 2023 at 18:56

I've tried fiddling around with your rig and honestly, the best solution might be to use drivers. Don't be scared, they don't have to be too daunting.

Look up a beginner tutorial for drivers. What you want to achieve is for the X movement of your Mover bone to drive the Z movement of your end bone. You may have to tweak it slightly to keep it in sync.

This may also work better if the bones are connected together in one chain - as this may also force the middle bone to adjust its length as needed without the track to constraint. If this works then it'll also hopefully prevent the dependency cycle of having your end bone be the target of your track to constraint on the middle bone (a common cause of glitches and generally bad times)

I'm not sure if there's a simpler solution but I'd be happy for someone to come along and suggest one.