Translation limits on child nodes in Max

So… There’s dangers in not having other tech artists around you all the time. The biggest danger is feeling like a noob, but I can’t seem to find an answer to this question, and it’s driving me nuts.

I want to be able to limit the distance a child can possibly move from its parent in Max 2012. I’m sure this is simple, but I’m constantly finding out about things it seems everyone else already knows that are hidden somewhere in plain sight.

The IK/FK plugin at http://joleanes.com/scripts_plugins/ is a good example of what I’m looking for. If you try to move the IK goal past the end of the bone chain, it just sticks to the end of the last bone. Can this be done in script in Max, or is this sort of thing only possible as a plugin?

http://download.autodesk.com/us/3dsmax/2012help/index.html?url=files/GUID-AA81EA1A-B4E1-4B47-B3AE-7C4AD62E24F-0.htm,topicNumber=d28e3778,hash=GUID-78A6D949-65A2-4E11-B51B-AC60B28599B6

limit controller should do the trick

Well, yes and no. This kind of works, but I guess I wasn’t quite specific enough.

I suppose what I want to do is make it so that there’s a maximum distance I can move object B away from object A. The Limit controller only really lets me limit individual tracks, so while I can limit X, Y, and Z each, that gives me a cube volume of potential locations; my maximum distance away becomes length(max(X), max(Y), max(Z)). I was hoping for a spherical volume.

I tried doing this in a position script, but position scripts don’t like it when you self-reference at all. It was sort of:

offset = b.position in coordsys a
dir = normalize(offset)
dist = length(offset)
if (dist > maxLength) (
offset = dir * maxLength
)

That’s really just pseudocode, so don’t analyze it as proper MaxScript, please. That’s pretty much what I’d like to do, but I can’t legally put that in a position script controller. What are my options?

Edit: Let me stop beating around the bush.

I want to have an object as an animation controller on my rig. I want to be able to control a bone chain with it, but I don’t want to be able to move the controller to a place that’s outside the length of the bone chain. What are my options?

To avoid self reference errors there is a way to create a weak reference in a custom attribute.

Paul Neale has a great tutorial on his site.
http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm

Ok… This certainly seems to be what I’m looking for, but is there a reason that this seems to evaluate only if I’m not on frame 0?

edit: Also, my results seem quite wonky, but it’s more than likely my fault anyway… need to poke at this more, but it seems quite erratic. Updates don’t seem to happen consistently, and it doesn’t seem to matter if I’m using forwardTransformChangeMsgs set to true or false.

As far as i know it is only possible as a plugin. I suggest that you use other resources for your query.

one last thought why don’t you use a bone as the control. The end of a bone of a chain will not let you pull it past the end and it acts as you describe