View Full Version : FFD consternation

04 April 2009, 08:34 PM
I want to write a script that will take whatever particular point of an FFD lattice modifier, and move it to a specified position in world space. I've looked through some of the other threads, and found things that look like they could be helpful, but I guess I am just not smart enough to understand them.

I've seen that JHN has suggested this script: That looks really great, and like it can do what I need... except that for some reason I get an error every time I try to run it. And, I don't really know enough to grab the stuff I need from it.

Can anyone help?

04 April 2009, 09:02 PM
ObjX=$Box01 --Your obj
B = [-167.206909,-0.764248,0.000000] --put point3 here
ObjXFFD=OBJX.modifiers [1]
animateVertex ObjXFFD #all
boxMin = getModContextBBoxMin ObjX ObjXFFD
boxLen = (getModContextBBoxMax OBJX ObjXFFD) - boxmin
LocPoint = B * (inverse ObjX.transform)
FFDPoint = (LocPoint - boxMin) / boxLen

objX.modifiers[1].control_point_2 = FFDPoint

04 April 2009, 09:35 PM
EDIT (again): The reset transform worked, problem solved. Thank so much for the help! I'll post the script I'm using this for when it's functional. :)

EDIT: Never mind, I tried it with a "clean" scene and it worked. I'm guessing I need to do a reset transform or something on my object...

Thanks for the quick reply!

Okay, right away I know something isn't working, because when I set the desired coordinates to [0,0,0] it's ending up at X:-6.329, Y:1.241, Z:1'0.736. When I then check its position with $.ffd_2x2x2.control_point_2 it gives me [-3.72876,0.00143301,0.26251].

04 April 2009, 12:25 AM
The following thread might be of some help:

Is there a way to move ffdBox control points with maxscript?

It contains functions to convert from FFD local to world position and back.

04 April 2009, 04:44 PM
EDIT: Never mind, it turns out that it's nothing to do with the FFDs, just Max's rotation flipping issues. Thanks everyone for the help!

Oh no.. all that and now I am finding I have another problem. Is there any particular logic to the orientation of an FFD lattice? What I mean is, when I was working with my original object, control point 1 was on the front bottom left corner. Now I look at the lattices on two other objects with less than a 10 degree difference in orientation from the first one, but one has control point 1 on the back top left corner, and the other on the front top right corner.

What is it that determines the orientation of an FFD lattice??

CGTalk Moderation
04 April 2009, 04:44 PM
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.