ScriptSpot

Forum topic · General Scripting

Modify this pivot-to-face code so that it can be used for multiple selection at once

By Haider of Sweden · 2016-04-06

Description

Hi

Please see this code (which I found http://www.scriptspot.com/forums/3ds-max/general-scripting/align-pivot from 2012)

Also, by some reason, the pivot changes to something else when the code is run a second time.
So if the method can be done better, please just improve it. Thanks!
(ps, I removed the mxs/code tag because it messed up the text by some reason..)

fn RotatePivotOnly obj index=
(
rot = (matrixFromNormal (polyop.getFaceNormal obj index)*obj.transform ) as quat
rotValInv=inverse rot
animate off in coordsys local obj.rotation*=RotValInv
obj.objectoffsetrot*=RotValInv
obj.objectoffsetpos*=RotValInv
)
for a in selection do
(
setrefCoordSys #local
CenterPivot a
theNormal=polyop.getFaceNormal a 1
RotatePivotOnly a 1
)

Comments (1)

.

Haider of Sweden · 2016-04-20

Solved by Miauu here

Thank you!!