Home Technical Talk

How do you move the pivot to the bottom center of an object?

This feels like a pretty stupid question, and I'm SURE I've learn't this before, but anyway, I'm going through splitting up my futuristic buildings into more bitesize segments, so I can give them higher resolution textures, and so UDK doesn't have a sub-arachnoid hemorrage trying to render them with lights all over them and other effects in the level. With this particular building being a pretty simple block of flats, all I need to do is cut it into about 8 pieces (like how you might slice a carrot lol). The problem I'm having though, is that I want to reposition the pivot to the bottom center of the objects (for easy alignment in UDK).

This was easy for the bottom segment, all I had to do was put "0" for Z into the move tool for the pivot. It was also easy for the 2nd object, but a really stupid, overly complex way of doing it, which was moving the 2nd object down by the exact height of the 1st object, then Z "0'ing" the pivot, and moving the object back up using the height of the 1st object.

As you can probably see, this is NOT the way most people would do something like this lol, and I'm probably giving a new meaning to the phrase "taking the long way round"! I thought there was an align button that did all this for you, but I cant seem to make it sing for me.

I should really know how to do this by now, but thanks to anyone who can set me straight haha.

Replies

  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    i tend to just snap my pivot point to a vert in the bottom corner of hte prop, and when i export to fbx i got a script that centers thigns in the scene by there pivots before export, than puts them back.
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    There's also miauu's Visual Pivot. Awesome script.
  • Mark Dygert
    Options
    Offline / Send Message
    I do what passerby does, manually set my pivot point (hierarchy tab > effect pivot only) and snap to a vert, that was normally snapped to the grid.

    Then at export I use this script to move the object to 0 0 0, export and then it automatically moves it back to where it was in the scene.

    http://www.polycount.com/forum/showthread.php?t=93587

    Also there are several scripts on scriptspot.com that allow you to place the pivot in pre-defined areas around the mesh but they are determined by the bounding box of the object not the actual vertex placement or the grid, so unless your objects are all EXACTLY the same size and shape they probably won't work that well.

    Snap the pivot to a vert, snap the vert to the grid, everything works.
  • Shuriken UK
    Options
    Offline / Send Message
    Thanks I'll try these methods out, because doing it my way was just going to take too much fiddling around lol.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    the other nice thing about getting or making a scirpt, is for batch exports, i can export every object or group in my scene as it;s onw fbx, so it;s own assets in udk with 1 click.
  • Mark Dygert
    Options
    Offline / Send Message
    One other thing you can do, in certain cases like this... is leave the pivot where it is and detach all of the separate pieces. Each floor will be floating higher than the lower ones but that way when you import the pieces they all snap to the exact same spot on the grid and should align.

    In general this isn't ideal for a lot of things but it can get you out of a tight spot quickly, especially if the floors aren't snapped to the grid.
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    script for this is something like:

    $.pivot = [$.center.x,$.center.y,$.min.z]

    have fun!
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    cw wrote: »
    script for this is something like:

    $.pivot = [$.center.x,$.center.y,$.min.z]

    have fun!

    Correct me if i´m wrong but shouldn´t it be:

    $.pivot = [$.center.x,$.min.y,$.center.z]
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    Max is z-up. Last time I looked (just before I posted that!) :)

    If I am wrong, I apologise, but the gist is there. Rushing.
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    What I do is go into Affect Pivot Only mode, then click Align, and click the same object. In it you just check Z Position, and set the Current Object to be the Pivot Point and the Target Object to be Minimum.

    It's a bit longer I guess, but no scripts needed.
  • Mark Dygert
    Options
    Offline / Send Message
    Z-up is right. The code will center it at the lowest center point, of the bounding box. I almost posted a old script that I wrote a while ago that contained that line of code but decided against it. The code works fine for stand alone props and objects that don't need to align together.

    If one object has a piece that hangs off to one side, the pivot will be off center.
    PivotCenter.jpg
    These two objects will no longer properly align once placed in UDK, but if you snap the pivot to a vertex that will align then it will work.
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    Good points vig.

    If you wanted something which put the pivot to the selection's lowest object's minimum z, or the average z, or zero z it is trivial to tweak that scrap of script! :) It's even easy to take the minimum z of a particularly named object (your _root_ object, if you will)

    If I can do anything to assist, let me know. :)
  • Shuriken UK
    Options
    Offline / Send Message
    I think I want to start getting into scripting! Is it hard though? I'm currently trying to wrap my head around Unrealscript (based on C++) and to say progress was going slow, would be one hell of an understatement...

    Im always thinking things like "Damn I wish there was a way of", or "why cant you just", or "things would be so much quicker if" ETC while modelling, and I'm pretty sure MaxScript is the answer.

    BTW thanks for that little script snippet, and the advice from all of you, its much appreciated!
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    The snap-pivot-to-vert is a good trick :)


    ShurikenUK: Vig posted a nice little introduction to Maxscript on the front page a while back - http://www.polycount.com/2011/05/16/maxscript-for-newbies/ .. Max's listener can help lots for little scripts.

    Might also want to check out the Tech-Artist forum. Lots of people with big superbrains hang out there.
  • jerry
    Options
    Offline / Send Message
    Hi,

    I once made a script that might help you out:
    setpivot.jpg

    Download SetPivot.ms
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    Maybe I'm being a little silly, but why are these scripts needed? Unless I'm missing something, you can do all this stuff using the align tool.
  • jerry
    Options
    Offline / Send Message
    It's just to same some clicks :)
  • SsSandu_C
    Options
    Offline / Send Message
    SsSandu_C polycounter lvl 13
    well you can do this with scripts and without... duh!!!! If you want a one click solution then with scripts, turbotools has this option and many other. Maybe some people don't know this but there is the Edit->Tranform Toolbox(max 2011 here) and from there you can put the pivot on the bottom on the top left right and center. For bottom just choose center and the min, z and there ya go.
Sign In or Register to comment.