PDA

View Full Version : MaxScript - Get the true PRS of an X-Formed object


charlieb
29-09-2003, 09:57 PM
Hi there,

I'll jump straight into my problem.

I want to animate a cube rolling along, and I want to deform it using an FFD. I want to use X-Form to animate the rolling cube as it allows me to animate the pivot point, very useful indeed.

So I build my stack Box > XForm > FFD

In this situation the FDD is carried along with the cube, but the lattice does not follow the rotation. In fact the FFD simply wraps itself around the bounding box of the cube - not very useful.

I re-order the stack Box > FFD > XForm

In this situation the FFD is simply left behind by the cube.

After a bit of poking about in maxscript I use the Box > FFD > XForm ordering and the following piece of code to extract the rotation of the xform and feed it into the FFD lattice Rotation controller


obj=$Box01
objTM=obj.objecttransform
modTM=getModContextTM obj obj.xform
rpnt=obj.xform.gizmo.rotation * (inverse modTM) * objTM
(inverse rpnt)


This rotates the FFD lattice to follow the cube. However I cannot work out how to position the FFD around the cube. Everything I try the FDD just pops all over the place. It is a weird thing that you cannot get the PRS of the Xformed object, its a weird freaky controller and I don't know how to do it.
If you have a suggestion, or a better way to animate pivot points in max then I would be most grateful.

thanks!

Charlie B