The plugin works with objects that are ungrouped and have already been animated, a situation that the built-in motion path facilities of Maya don't easily accomodate. The plugin creates a NURBS motion curve (using Maya's builtin functions) that the user can edit to change the objects' path. It then calculates each object's position and orientation relative to the motion curve throughout the requested timeframe and sets things up so that these relative parameters will be preserved as the motion path is changed. For example, for an animation of a person walking sideways, if the originally-straight path is curved by the user, the figure should continue to walk sideways along the curve.
Getting a NURBS curve to closely follow an object's path can be difficult. Our approach was to have the curve match the object's postion at all the keyframes and hope it stays close in between. However, this was not always the case. Sometimes, added keyframes helped; sometimes, they made it worse. Sharp turns can be especially bad.
Once we have the motion curve, we need to calculate each object's position and orientation relative to the curve. For each parameter, we look at every keyframe, find the appropriate place on the curve, and calculate the relative value. The parameter's AnimCurve is then modified to reflect these new values.
These calculations are based on the Frenet frame for the appropriate place on the curve. We get the Frenet frame using the tangent to the curve and the y axis. To get the object's relative rotations, we take the rotation matrix of the Frenet frame and multiply the object's rotation matrix by its inverse. To get the relative translations, we take the difference of the object's position and the point on the curve and project it onto the axes of the Frenet frame.
Next, a new transform node is created. Its inputs are attached to the NURBS curve via a motion path node (with follow turned on). The objects' transforms (which now have relative translations and rotations) are then reparented under the new transform.
Our original plan was to have a ballerina dancing around and jumping in the air, and then have him do the same moves along a different course. But we discovered too late that the human figure we had wouldn't work properly with the plugin as written. The plugin assumes that all the objects it's animating are independent. This wasn't the case with our human since the objects we were modifying--the body, hands, and feet--were connected. We found that any major turning of the body in the original motion resulted in the figure becoming a contortionist after the plugin ran. Jumps caused the the NURBS curve vary radically from the original motion. We had to settle for a straight-line walking motion as the original movement.