In my eternal quest to make the world a better place I often stumble across stuff on forums and web sites that, while it usually solves the immediate problem, makes me think “There must be a more elegant way!” This is one of these cases.
It must have been the time around Christmas when this came up. The requirement here was to keep the axis of the hinge aligned in such a way that the wings would target the next item in the chain and still be aligned as if the axis was rigid and all this needed to be done en masse with a MoGraph Cloner. Enthusiastic as I was I was quick to suggest a bunch of mixed Target Effectors to take care of the matter, but no such luck. No matter how you set things up, eventually everything would move out of alignment. You could get it to work for one plane, but as soon as you added a third dimension, it looked whacky or at least not “correct” in a technical engineering sense.
Ultimately the user solved it by using the Cloner along a spline and defining a second spline to server as the rail, but this in my world is still unsatisfying. It’s not mathematically exact and who wants to spend his time tugging on spline points, anyway? When you have a lot of items and your splines overlap and self-intersect this could become quite confusing. So there I was with my half-working setup and another half-good idea and somehow this always was at the back of my head until finally I now sat down to resolve it once and for all.
YouTube version here
It involves quite a bit of XPresso, but ultimately isn’t that complicated once you put your mind to it. As a matter of fact the more challenging part was figuring out how to avoid the dreaded race conditions when you comb through multiple nested hierarchies (if they are not chained suitably their results will not make sense because one will be faster than the other). Of course nothing is ever perfect and so e.g the ropes, which are based on LoftNURBS look a bit twisted and weird, but the basis is sound and from here on it should be easy enough to add some more code to define custom up vectors or compensate the rotations when needed.
As a fun challenge and practice I modeled the hinge parts and the basic cog wheels in modo as subdivisions (the actual teeth are Cinema‘s Gear spline also rigged with XPresso) and I also picked out some sounds to make things a bit more interesting…