![]() ![]() Local TmScale = scaleMatrix Obj.objectOffsetScale Local ChldTms = in coordSys Trgt ( for Chld in Obj.children collect ansform ) If classOf Trgt != matrix3 then Trgt = ansform ![]() This fails miserably for any objects having a negative or non-uniform scale, but it seems to work well in any other case I have tested: ( ![]() If anyone gives it a try here, please let me know if it isn’t working in some cases, and if so in which cases. This does not take scale into account, so if you have a scaled object whose pivot you want to transform, but the scale of the target matrix does not match, you get incorrect results.Įven without scale, I am not entirely sure this really works in all cases, I have not done any extensive testing. The main addition to what we already had is the transformation of the objectOffsetPos value into the new local coordinate system. transform only the pivot of "t" so it matches "new" the pivot's z axis should be (negative y axis), the pivot's y axis should be (positive x axis), the pivot's x axis should be (negative z axis), define a target transform matrix for pivot: create copy so we can check later in the viewport whether the geometry has moved create some initial geometry and transform it somehow as a starting point counter-translate to remove translation from geometry Local new_op = (newX * (transMatrix dvec_world) * (inverse newX)).row4 transform translation vector from "world" to "new" coordinate system compute translation vector in world space counter-rotate to remove rotation from geometry compute "difference" transformation between old and new transform entire object such that pivot matches target transform matrix !! currently works only correctly for non-scaled objects !! newX: matrix3 value with new transform for pivot obj: object whose pivot should be transformed Sets the transformation of the pivot of an object without moving the geometry Here is something I cooked up which seems to work correctly for non-scaled objects: Very much like if you interactively turn on “Affect Pivot Only” and then use the Align tool to transform the pivot, with all align options (especially “Align Orientation (Local)”) on. But basically I want to transform the pivot into fixed orientation that is given in a matrix3 value, without moving the geometry. Oh, and sorry for being vague with what I am asking for, it’s a bit hard to explain. The function is great to rotate the pivot 90 degrees around the X axis, for example, but when the pivot’s z-Axis should point exactly along and the x-Axis along, for example, some more math is needed. I have seen the page and the function, unfortunately, the function only does a relative/incremental rotation, whereas I need an absolute orientation. While I was hunting up a solution for you I came across an example function called rotatePivotOnly, which might do what you’re after. If I get what you’re asking, you might want to check out “Using Node Transform Properties” in the maxscript manual. ![]()
0 Comments
Leave a Reply. |