PDA

View Full Version : FFD2 Modifier Sub-Object Transform Properties


freesmith
10-27-2008, 06:19 PM
Hi, everyone :wip:.
I'm trying to move control points in FFD trough script.
Generallly I want to take world coordinates and transfrom them in FFD space and move specific contol point there.
in help I found that to convert from local to world coordinates, you multiply the local coordinates by the node’s objecttransform matrix. To convert from world to local coordinates, you multiple the world coordinates by the inverse of the node’s objecttransform matrix
like:
obj=box pos:[10,20,30]
addModifier obj (affect_region())
objTM=obj.objecttransform
modTM=getModContextTM obj obj.affect_region
-- calculate world coordinates of end point
obj.affect_region.end_point * (inverse modTM) * objTM
-- set end point at world coordinates [20,20,0]
obj.affect_region.end_point = [20,20,0] * modTM * (inverse objTM)
and also there is explanation about specific case regarding FFD and control points, couse it has it's own local normalized space

b=box pos:[10,20,0]
ffd=ffdbox()
addModifier b ffd
animateVertex ffd 64
cp64posL=ffd.control_point_64
objTM=b.objecttransform
modTM=(getModContextTM b ffd)*ffd.lattice_transform.value
modBBMin=getModContextBBoxMin b ffd
modBBMax=getModContextBBoxMax b ffd
cp64posW=(modBBMin+(cp64posL*(modBBMax-modBBMin)) * (inverse modTM) * objTM
this is the way you get world coordinates of specific control pointg in FFD!

But I need the oposite! I want to transform world coordinates to FFd local space coordinates, and I,m still trying to figure how to do that.
Is there anyone who can help?
Best regards!

JHN
10-27-2008, 10:04 PM
There are some scripts on scriptspot that do this, I think this one does : http://www.scriptspot.com/3ds-max/dummiesforffd

Hope this helps,
-Johan

CGTalk Moderation
10-27-2008, 10:04 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.