Transform pivot point with a matrix3 tm
I wrote this function a while ago for an exporter tool, where I needed to align the pivot of collisions objects with the transform of the master object. I couldn't find another way to "affect pivot only" (as in the UI) using maxscript, It will set the .transform (a.k.a. the pivot point) of a node to the provided matrix3. It gives more possibilities than the standard "affect pivot only:" from the user interface, as you have full control of the transformation matrix. Here's the function:
<code>
fn setTM obj tm =
(
newOffset=obj.ObjectTransform *(inverse tm) -- calculate the offset in the target TM space
obj.objectOffsetScale=newOffset.scale
obj.objectOffsetRot=newOffset.rotationPart
obj.objectOffsetPos=newOffset.pos
obj.Transform=tm
)
</code>