Notifications
Clear all

[Closed] HELP: FFD coord system

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

Any help will be welcome.

Thanks in advance!!!

9 Replies

Look up “Modifier Sub-Object Transform Properties” in the maxscript help.

-Eric

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?

Replace the modTM info with the transformation of the spacewarp as the sub-objects should be local to that transformation matrix.

-Eric

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!!

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

This is what i have done based on the example (with no luck): 🙁

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?

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.

Thanks jonlauf, it worked :bowdown:
The thing is what if the pivot is not centered?

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
)