Announcement

Collapse
No announcement yet.

Max script help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Max script help

    I've got an object that I've broken up to do particle flow stuff on, but to do what I want I need the pivot point of each object alligned to it's face, and following the surface.

    I can reset to object and move them around, but it doesnt seem to do anything for the rotation values, which all go back to world which is no help whatsoever. (see attached image)

    Now to the problem - i'm assuming I can fix this with a script, because when I put an edit normals modifier on each object it shows it properly, so the information is there in max. Now how do I go about getting that normal information from each object (each object is 1 poly) and applying it to the pivot point location, so it faces the right way and follows my objects? just 'have the z axis follow the normal direction' would work.

    I've been digging in maxscript all morning and i cant find out how to take the normal information out of objects.

    In the attached image all those faces are seperate objects, and I want the pivots to be alligned to the face.
    If a particular section has the y or x in the wrong direction it's no big deal, I can sort them out easily - I just need them to follow the allignment of faces.



    I will be doing it on a much bigger object that has been split up and detached, modeling it from scrach would be one of the most time consuming things ever.
    People do this all the time, or am I completley on the wrong track for how to do it?

    Thanks in advance
    x
    Attached Files
    Last edited by Neilg; 03-04-2009, 06:29 AM.


  • #2
    This is the result i'm trying to get - the z is always facing out, although this is applied to an object cut into only 50 pieces - I moved and positioned most of these by hand.

    I'm just looking for the automatic version, because i'd like to use it split into much more pieces...
    Attached Files

    Comment


    • #3
      Cubicle,

      Its not scripted...hmmm..though i guess it could be...anyway...what i did was create a point helper with autogrid on...clicked on the objects face. Then i selected the object and turned on the affect pivot only and used the align tool to align the pivot to the point helper. Hope that helps...
      -----Dwayne D. Ellis-----

      Comment


      • #4
        so each object is just 1 face in the end result you're trying to do?

        Should just be a 1 liner, i'll check to make it work once max is done rendering....

        assuming they were converted to editable meshes after exploding.. something along the lines of

        Code:
        dummyObj=Box()
        for obj in selection do (
        CenterPivot obj
        dummyObj.pos = obj.pivot
        objFaceNorm = (getfacenormal obj.mesh 1)
        dummyObj.dir = objFaceNorm
        obj.pivot = dummyObj.pivot
        )
        delete dummyObj
        damn now you've got me curious as to why this doesn't work
        Basics: Create a dummy box, move it to the center of each object, align it to the surface normal of the first polygon, and then match the objects pivot to the dummy object, en-loop...

        But, its not working?! should get you started on the right direction though
        Dave Buchhofer. // Vsaiwrk

        Comment

        Working...
        X