ScriptSpot home

Forum topic · General Scripting

rotate pivot

By titane357 · 2011-09-22

Description

hello
I wanted to clone objects on selected polys of an object.
I didn't succeed.... (it has grown into a habit)
so I tried this :
example for a sphere :
- Break vertex
- detach all faces individualy (thanks soulburnscripts)
- apply my script, so I rotate pivot in face direction
- replace all these objects by another one (thanks soulburnscripts)

My problem is that my script rotate the pivot WITH the object.
No problem for what I want to achieve, but I don't like to see the objects rotate...
Can somebody explain what I've done wrong ?
Thanks.

-------------
for a in selection do
(
setrefCoordSys #local
CenterPivot a
theNormal=polyop.getFaceNormal a 1
maxOps.pivotMode == #pivotOnly
a.dir = theNormal
)
--------------

Comments (2)
kilad

first off
maxOps.pivotMode == #pivotOnly (should be =)

But it wont work like that anyway...

search for "Using Node Transform Properties" in maxscript help,
there's an example there that may help you

Reply to kilad
titane357

thanks for help.
I just found what I needed....
If that can help :
-------------
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
)
-------------