Align Pivot

First post here, i thank in advance for your patiente.

Lets suppose i have a sphere: after convert it to Editable Mesh, it is possible to Explode all its polygons into new objects.
The problem is the following: all these new objects inherit original sphere Pivot coordinates.
I know it is possible, by using Hierarchy panel, to select all the new objects, turn on Affect Pivot only and center the pivot on each object.
But - this is the main point - i have no idea how to align the pivots to each object Local coordinates (maybe i could refer to this as "align to each object Normal", since each one is a single polygon).

Is it clear what i intende? If so someone can help me to solve this?
(i have no experience with code and maxscript, but maybe you can aid).


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Fonte Boa's picture

The link to video

The link to video is:

Fonte Boa's picture

That worked, Kimarotta! I

That worked, Kimarotta!

I selected all the objects, converted it to Editable Poly, opened MaxScript Listener, paste the code into it and begin to hit Shift+Enter at each line. At the end, as you can see in video, all the Pivot points were aligned as i wanted.

As i have no experience with scripts, i just would like to ask how can a do to simply run that code without have to hit Shift+Enter at each line (sorry for the dumb question).

Thank you VERY much, Kimarotta!

The link to video is (maybe it is being yet processed at youtube):

Sou muito grato a você: obrigado.

kimarotta's picture

Select All Lines and "ENTER"

Select All Lines and "ENTER" in Numpad.
3d Artist  

kimarotta's picture

I found this... by

I found this... by titane357

works with editable poly...

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
for a in selection do
setrefCoordSys #local
CenterPivot a
theNormal=polyop.getFaceNormal a 1
RotatePivotOnly a 1
3d Artist  

Fonte Boa's picture

Oi, Kamarotta. Sorry for my

Oi, Kamarotta.

Sorry for my poor english. I recorded a video: a sphere was converted to Editable Mesh, all the polygons were selected, then i called Explode all. After this, it is easy to see all their pivot points are the same of the original sphere. Using Hierarchy panel, turning on "affect pivot only", i center the pivot points at each object.

The problem then is: how can i orientate all the pivot points to each resultant object Local coordinates (or, saying another way, how to align the pivot point to each object Normal, since each one has a single Normal)?

At the final of the video, i just selected one object (a single face resultant of the explode operation) and tried to rotate it to reach the face Normal: it wasnt a accurate operation, because i am running here to record the video, so please disconsider the imperfect performance, made just to exemplify.

The video link is:

Obrigado pela atenção.

kimarotta's picture

I do not know if I understand

I do not know if I understand exactly what you want ... but follows a little help.

	for i in selection do i.pivot =
3d Artist  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.