PDA

View Full Version : HELP: FFD coord system


magost
06-01-2011, 06:28 PM
Hi!!
I'm trying to do some staff with FFD (space warps) but their coord system is driving me mad :bounce:
Any idea of how convert the position of each control point to world space? I'm trying several things but none of them have give the right position. I know how to get the position of each control point but after that i do not know what else should i try to get what i want.
I'm left of ideas :cry:

Any help will be welcome.

Thanks in advance!!!

PiXeL_MoNKeY
06-01-2011, 08:23 PM
Look up "Modifier Sub-Object Transform Properties (http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-1E2277FE-7854-4404-89A9-9D72C07CDBD-1107.htm)" in the maxscript help.

-Eric

magost
06-01-2011, 09:34 PM
The thing is that this example is for a FFD modifier and not for a FFD space warp. There is any way to adapt the example to a FFD space warp?

PiXeL_MoNKeY
06-01-2011, 09:48 PM
Replace the modTM info with the transformation of the spacewarp as the sub-objects should be local to that transformation matrix.

-Eric

magost
06-01-2011, 09:54 PM
Thanks for the answers.

What about the "ffd.lattice_transform.value" value.
And those lines?
modBBMin=getModContextBBoxMin b ffd
modBBMax=getModContextBBoxMax b ffd

Can i add any modifier to the ffd and change them by
modBBMin=getModContextBBoxMin ffd anyMod
modBBMax=getModContextBBoxMax ffd anyMod

Thanks again!!

PiXeL_MoNKeY
06-01-2011, 10:08 PM
You will have to build your own bounding box values using the Spacewarp Center, +/- 1/2 .length value, +/- 1/2 .width value, and +/- 1/2 .height value to get the minimum and maximum bounding box values.

-Eric

magost
06-02-2011, 01:34 PM
This is what i have done based on the example (with no luck): :sad:

theFFD = $
localPoint = theFFD.control_point_1
objTM = theFFD.objecttransform
modTM = objTM
modBBMin = [theFFD.pivot[1] - theFFD.length/2, theFFD.pivot[2] - theFFD.width/2, theFFD.pivot[3] - theFFD.height/2]
modBBMax = [theFFD.pivot[1] + theFFD.length/2, theFFD.pivot[2] + theFFD.width/2, theFFD.pivot[3] + theFFD.height/2]
worldPoint = (modBBMin+(localPoint*(modBBMax-modBBMin))* (inverse modTM) * objTM)

Any idea?

jonlauf
06-03-2011, 02:14 AM
This one is a little weird and there are probably more elegant solutions but here is mine:

theFFD = $
for i = 1 to theFFD.baseobject[#Master].numsubs do
(
theBounds = [theFFD.width, theFFD.length, theFFD.height]
theMin = theFFD.pos - theBounds/2
theLocalPos = theFFD.baseobject[#Master][i].value
theWorldPos = theBounds * theLocalPos + theMin
print ("control point " + i as string + " position")
print theWorldPos
)

This requires that the control points you are acquiring already have a controller assigned and that the pivot of the space warp is in the center of the object. Let me know if it works or if your having trouble.

magost
06-07-2011, 02:47 PM
Thanks jonlauf, it worked :bowdown:
The thing is what if the pivot is not centered?

jonlauf
06-07-2011, 03:59 PM
Looking at it again, I believe you can use the objecttransform property to create an accurate bounding box location without the dependency of a centered pivot. Try the below code and let me know if its working for you. On a few quick tests it seems to work for me. Cheers.

theFFD = $
for i = 1 to theFFD.baseobject[#Master].numsubs do
(
theBounds = [theFFD.width, theFFD.length, theFFD.height]
theMin = theFFD.objecttransform.row4 - theBounds/2
theLocalPos = theFFD.baseobject[#Master][i].value
theWorldPos = theBounds * theLocalPos + theMin
print ("control point " + i as string + " position")
print theWorldPos
)

CGTalk Moderation
06-07-2011, 03:59 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.