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
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.
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.
$.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]
If I am wrong, I apologise, but the gist is there. Rushing.
It's a bit longer I guess, but no scripts needed.
If one object has a piece that hangs off to one side, the pivot will be off center.
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.
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!
If I can do anything to assist, let me know.
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!
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.
I once made a script that might help you out:
Download SetPivot.ms