[Closed] Move and rotate to a face
Well this should be very simple, but I kept banging my head against it last night and couldn’t get it to work.
What I want to do is to place an object and rotate it correctly onto a face of an poly. So exactly like the autogrid.
This is what I write:
tPos=polyOp.getFaceCenter $ iFace node:#World
tNormal=polyOp.getFaceNormal $ iFace
tm=matrix3 1
tm=matrixFromNormal tNormal
newObject.rotation=inverse tm-rotationpart
newObject.pos=tPos
I’m thinking that perhaps I’m mixing coordinate systems or something like that.
/Andreas
rotation in max 6.0 is a quaternion var. so you have to convert it to quat. See max ref for details on quats and converting them to other types and vise versa. Hope it works.
This might not solve your problem, but it seems you have a typo in this line:
tm-rotationpart should probably be tm.rotationpart.
- Martijn