[Closed] orientation of the pivot to the orientation of the pivot
I need copy the orientation of the pivot of one object to the orientation of the pivot of another object, with maxscript…but, only the pivot, and reeally the same orientation
anybody knows how?
thanks!
I’m not sure what you mean…
You can set alignments in world space using transform matrix ie.
$box01.transform = $box02.transform
you can not set the elements of the objects transform matrix directly i.e
$box01.transform.pos = [0,0,30] …does nothing
so if you only what to copy the rotation part of the transform for $Box02 to $Box01 you need to do this…
[color=DeepSkyBlue]Tm=$Box01.transform
Tm.rotation = $box02.transform.rotation
Tm.pos = $Box01.transform.pos
$Box01.transform = Tm[/color]
note that you need to set the postion of the transform again after seting the rotation…
If you just want to rotate the Pivot point of the object with affecting the apparent position of the object in space (like you can in ‘affect pivot only mode’ on the hierarchy panel) then you need to look into the ‘Object offset transform’. ie using…
$Box01.objectoffsetpos
$Box01.objectoffsetrot
$Box01.objectoffsetscale
The Max help give this function as an example
fn RotatePivotOnly obj rotation =
(
local rotValInv = inverse (rotation as quat)
animate off in coordsys local obj.rotation = RotValInv
obj.objectoffsetrot=RotValInv
obj.objectoffsetpos*=RotValInv
)
Thanx very much KenT, I triying move only the pivot not the node, like ‘affect pivot only mode’ but whith maxscript.
I’m actually using that Rotatepivotonly function , but I’m aligning the pivot point of one mesh to a pivot point of a dummi or point, and It isn’t work well, the pivot isn’t in the same orientation, If you execute this function a lot of times you can see how the pivot point is rotating and I don’t know why.
I try activate the ‘affect pivot only mode’ with maxscript and then rotate, but when I rotate with maxscript the node rotates too. like this:
MaxOps…[font=‘Courier New’]pivotMode = #pivotOnly[/font]
rotate $ (angleaxis -11.0797 [-0.784374,0.333691,0.522883])
this not work well
A little help please!!!
fn RotatePivotOnly obj rotation = (
local rotValInv = inverse (rotation as quat)
animate off in coordsys local obj.rotation*=RotValInv
obj.objectoffsetrot*=RotValInv
obj.objectoffsetpos*=RotValInv
)
This funcition is in the MAX Script documentation. It rotates the pivot only.
Stev
Ooops, didn’t see it was already posted. Sorry.
Try this
a = $box01.rotation;
b = $box02.rotation;
c = a - b;
RotatePivotOnly $box01 -c;
Stev