XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : rotate object only, but not axis

07-24-2011, 10:36 AM
I need a script to rotate selected bones on set angle, but axis shouldn't move/rotate.
From different sources I collect 3 variants of script, but all of them rotating not only bones but also axis.
So could anyone help me find a solution.


toolMode.coordsys #local
maxops.pivotmode = #objectonly

rotate $ (angleaxis -90 [0,0,1])

toolMode.coordsys #local
maxops.pivotmode = #objectonly

currentMatrix = $.transform
preRotate currentMatrix (eulertoquat (eulerAngles 0 0 -90))
$.transform = currentMatrix

-- Set the given object's rotation to the given values

toolMode.coordsys #local
maxops.pivotmode = #objectonly

fn SetObjectRotation obj rx ry rz =
-- Reset the object's transformation matrix so that
-- it only includes position and scale information.
-- Doing this clears out any previous object rotation.
local translateMat = transMatrix obj.transform.pos
local scaleMat = scaleMatrix obj.transform.scale
obj.transform = scaleMat * translateMat

-- Perform each axis rotation individually
rotate obj (angleaxis rx [1,0,0])
rotate obj (angleaxis ry [0,1,0])
rotate obj (angleaxis rz [0,0,1])

-- Set currently selected Object's rotation to 80 50 100
SetObjectRotation selection[1] 0 0 -90

important qualification: after rotating (or before, it doesn't matter) i need to make small all selected bones, for example
$.width = 0.125
$.height = 0.125
$.length = 0.125

CGTalk Moderation
07-24-2011, 10:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.