Posted by: Jeff | 2009/10/07

MaxScript: moveToPath

Move To Path

Move To Path

At the office, while waiting for feedback from my finished shots, a recurring thought revisited me. It was about an old problem that I encountered in a 3dsmax modifier called the PathDeform. I’m talking about the Object-Space version, where there’s no equivalent Move To Path command.

So since I had some time to spare, I started collecting thoughts on how to approach it. It all boiled down to these:

  • Get a direction vector from the spline to derive a matrix which will be used for the alignment. (Use the How do I align the UVW_Modifier’s Gizmo to a selected face? from the FAQs section in the MaxScript helpfile.)
  • Figure out how to rotate it after the alignment. (Also from the FAQs, How do I find the angle between 3 vertices?)
  • Add controls for tweaking. (As can be seen from the UI, I added quite a lot.)

After a few hours of scripting, I got it to work (partially..). Three major problems I’m encountering:

  • It doesn’t always align perfectly to the spline, if you zoom in very closely,  you would notice the separation from the sub-object spline and the target spline.
  • Paths that are NOT created from the top/perspective views doesn’t work. You will need to tweak the Local Rotation Offset controls to get a close to proper alignment.
  • Lastly, if you’re planning on animating the spline, you’re out of luck because the moment you change the shape of the spline, you will need to re-align it again using this script.

Overall, it works quite well and is probably usable in most cases, you’ll only need to be aware of the few precautions mentioned above.

I also found links in the CGTalk forums related to the Move to Path problem of the OSM PathDeform:
The posts to take notice of is from Dubbie, we seem to have encountered a similar problem when aligning.

I would upload the script here but it seems like wordpress doesn’t allow uploading of certain file types, including .zip and .txt files. I will have to find myself a web host so that I could upload anything I want. I’ll update this as soon as I find a good one.

Feel free to email me for now if you want to try this script.

Edit: I was able to uploaded it to my Personal Files section at ScriptSpot:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: