Limit Distance Contraint Question

Hi everyone,

So I have a limit distance constraint on an object say ‘cube’ where I want it to always stay within 1 unit of ‘sphere’.

This works fine using clamp region ‘inside’, but I have an additional requirement i cant get to work.

So when you move sphere away from cube, once it’s 1 unit away the cube starts to move, ok great. However, when the sphere moves back towards the cube, the cube maintains a distance of 1 from it, until it is back in the place of its ‘goal’ or actual position.

Is there a way to have limit distance work more like a leash? so that if the sphere moves back towards the cube, the cube doesnt move towards its original location until the sphere has moved past it, and is pulling it rather than pushing it?

It sounds like the ‘inside’ setting would do this, but it does not.

EDIT: sorry for the typo in heading

Humm, Limit Distance works like leash to me. Do you have the constraint on cube, with target of sphere? And, controlling the cube location by moving the sphere?

@ vanish: There’s two difficulties here. First, the calculation of the region used by Limit Distance is based on the cube’s initial global location, but you need it to be calculated on the basis of the cube’s constantly-changing location, the change due to being dragged around by the sphere. Second, you need the influence of the constraint to stop as soon as the sphere gets within a certain distance of the cube (the “leash length”).

I’ve tried writing a driver to do this to affect the Influence of various kinds of constraints, but it goes beyond me. I’m not sure a constraint can be handled this way. I’m pretty sure it could be done via scripting, however.

@ ridix: You can drag the cube around, yes, but it moves even when you try to reduce the distance between sphere and cube, until the cube returns to its start point. An actual leash (of the non-rigid variety at least) would not do this, the dragging would stop as soon as you reduce the distance to the leashed item to less than the leash length, regardless of the position of the leashed item.

Thank you both for your answers and thank you Chipmasque for explaining my exact problem to ridix, it’s a hard one to explain and I’m not sure I did a great job the first time.

I thought this might be the case, it seems the objects always have a goal of the proper xyz location, i wonder if ther is a way to free this goal or update it. I will look into some scripting options.