View Full Version : API: MFnMotionPath

12 December 2010, 12:00 AM
Good evening all,

I'm rather new to Maya API programming but not programming in general. I thought i'd set myself a simple task to help the learning process and came up with this idea: a "motionPathDist" node

So a regular motionPath node works on a curve's U parameter whereby over time you can animate an input object along the 0-1 U parameter. However i'd like to change that to use distance instead. If using a 0-1 U value the user could change the shape of a curve thus making it longer or shorter and the objects position along the curve would stretch or compress. If using distance however the object would stay say 10 units along the curve at the animation point whether the curve grew or shrunk in length (so long as the length was always greater than 10).

This sounded simple enough but I'm getting rather stumped in the details... while i'd like to figure out the method of doing this myself if someone could give me some pointers that would be great!

My question is... can I do this in one node such as "motionPathDist" and somehow derive my new node from MFnMotionPath class (this is what I would like to do) Or will I have to create a chain of nodes such as curveLength[custom] -> UvalueConversion[custom] -> motionPath[standardMayNode]

what I don't really want to do is recreate all the functionality of the maya motionPath node (calculating normals, binormal, tangents and working out the rotation matrix of the object attached) and then adding my own curveLenthDistance attribute to do the translation along the curve.

I realise I could easily rig this up in minutes in maya with expressions and curveInfo node, but it thought it would be a good exercise to create one packaged up node :)

Any nudges in the right direction would be fantastic!

All the best,

CGTalk Moderation
12 December 2010, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.