Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Change an object's pivot point?

Discussion in 'Editor & General Support' started by mrittman, May 12, 2009.

  1. mrittman

    mrittman

    Joined:
    May 11, 2009
    Posts:
    40
    Hey I can't find this anywhere...Can someone tell me how I might go about changing an objects center point? I imported an object from 3ds max into Unity but Unity reset its center point to the center of the object.

    Thanks!
     
    blox5000 likes this.
  2. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,325
  3. mrittman

    mrittman

    Joined:
    May 11, 2009
    Posts:
    40
    I tried messing with both those buttons and they didn't do anything...
     
    blox5000 likes this.
  4. mrittman

    mrittman

    Joined:
    May 11, 2009
    Posts:
    40
    Figured it out. You have to convert the object to an editable poly inside of 3ds max before exporting it.
     
    blox5000 likes this.
  5. splashy

    splashy

    Joined:
    Aug 5, 2008
    Posts:
    8
    I too would like the answer to this, I have created a simple object in my 3d app (Modo) and although the pivot points were set correctly in the app they appear to be quite a way off on the x axis in Unity.

    If I change the pivot point in Unity it does indeed set the pivot point correctly in the view but when I rotate my object using code it is rotating around the offset pivot and not the correct center point.

    Any help offered is greatly appreciated.
     
  6. swtoasty

    swtoasty

    Joined:
    Dec 10, 2008
    Posts:
    25
    Using silo at the moment and I am having a similar problem. I've tried exporting as .3ds and .objs, and whenever I import them into Unity the pivot point on the objects are always way off center.

    Also, pretty sure that the objects pivot point in the 3d Application is centered...But when imported into Unity it becomes messed up.

    Is there anyway to fix this besides using the empty game object trick?
     
  7. Joe-Robins

    Joe-Robins

    Unity Technologies

    Joined:
    Apr 21, 2008
    Posts:
    430
    Just for future reference RE 3d Studio Max and pivot points, you can modify an object's pivot point inside max at any time using the hierarchy tab see attached image:
     

    Attached Files:

  8. Screenhog

    Screenhog

    Joined:
    Jul 2, 2009
    Posts:
    493
    Sometimes, the easiest solution is just to parent your mesh to an empty GameObject that was placed where you want your pivot point to be, and rotate that instead.
     
    tramelson, goodseller, EdGann and 3 others like this.
  9. NoirTalon

    NoirTalon

    Joined:
    Sep 20, 2009
    Posts:
    1
    There are just going to be times we have a bogus pivot point in a model, and we want it to rotate in a sane manner. It may very well be a bug that unity does not rotate about an objects center, or the bug may be that the pivot point can not be changed once the model is imported. I won't debate that here, but I will provide a fix.

    1)Create a new blank object in your scene, give it a name like "WackoPivotPoint"
    2)Put that object just where you want the pivot point to be, for the errent model
    3) Now make this new blank object a Child of the errent model
    4) whenever you want to rotate the errent model in script, use the "find" function from the errent model's transform. find the child transform by name. In this case
    Code (csharp):
    1. pivot = errentModel.transform.Find("WackoPivotPoint");
    5) Next use the RotateAround function to, well, do just that. in this case
    Code (csharp):
    1. errentModel.transform.RotateAround(pivot.position, Vector3.up,20)
    the following code uses a child transform called "SelectorPivot" to rotate around by 20 degrees


    Code (csharp):
    1.     var pivot : Transform = transform.Find("SelectorPivot");
    2.     this.transform.RotateAround(pivot.position, Vector3.up, -20);

    I hope this helps!

    P.S. don't bug me about the spelling. It's 2:45 am, and I just don't care.
     
    JohnnyBeCool_, idiot333 and Yoman like this.
  10. Westland

    Westland

    Joined:
    Jan 26, 2015
    Posts:
    10
    Ran into this issue, too. I was making several parts of an object in my 3D program, exporting them individually - ran into this issue with one of the exports. I messed a little with it, and it turned out, if the exported object in the 3D program was offset from the 0,0,0 point of the scene, that offset would come out with the export (and into Unity). So putting the object in the centrepoint of the scene before exporting, fixed it entirely.

    Rather odd, since there's plenty of other objects in the scene which were exported with an offset, and came in with a perfectly-centered pivot point in Unity anyway... No clue.
     
  11. Santiago1985

    Santiago1985

    Joined:
    Sep 19, 2013
    Posts:
    1
    -Create another empty object.
    -Put the object you want to rotate as a child of the new empty object
    -Move the object you want to rotate placing the desired pivot point in the center of the new (not emtpy anymore) object
    -From now on rotate the new object instead of it's child.

    That worked for me
     
    Hsni likes this.
  12. JohnnyBeCool_

    JohnnyBeCool_

    Joined:
    Aug 24, 2016
    Posts:
    1
    Hello everyone!, I've been strugglin the whole morning with the same issue presented above, NoirTalon made a great aportation and I'm willing to do too, here I found a tutorial solving the problem step-by-step, though i post this years later I hope this will be as useful as it was to me.

    http://www.41post.com/4101/programming/unity-rotation-controller

    Regards.


     
  13. EdGann

    EdGann

    Joined:
    Jul 17, 2016
    Posts:
    8
    You just saved me a lot of time.
     
  14. Westland

    Westland

    Joined:
    Jan 26, 2015
    Posts:
    10
    True, but just in case anyone's forgotten and/or don't know, this can add additional issues to working with the object in the future. Things like the object scale being linked to the parent scale (the 'ratio'), or if you're traversing the hierarchy searching for components via scripts (stuff like transform.parent.GetComponent) and so forth.

    Always best to catch things like this before it goes too far, and work from best practice, which in this case would probably be not having the pivot point issue at all, through a "correctly" done and exported model.
     
  15. BigScary

    BigScary

    Joined:
    Jun 4, 2014
    Posts:
    3
    Guys I'm having an awful time with this. I bought some assets with this pivot point problem - both in the meshes and the provided prefabs. When I tried importing the .obj files into blender and then re-exporting them each one at a time repositioned at the origin of my edit space, that fixed the pivot but the round-trip into blender made the assets look less awesome.

    So then I found a nifty editor plugin that sets a game object's pivot point. I thought my problems were solved - I spent 2.5 hours creating 20 new prefabs to replace those in the asset pack. Then I discovered that when I quit unity and open the project again later, those pivot adjustments were lost - they were only in memory and not saved in the in-scene objects or prefabs.

    I know I can make this work by building new prefabs where my models and their collision meshes are offset the same, but parented under a new object so that they can be locally offset. But that presents two annoying issues - I have to refactor my scripts to use this new organization for my objects, and I have to re-export my collision meshes so that they have the same bad offset as the render meshes they're supposed to match up with.

    Are there any better solutions? Ideally,a way to permanently adjust a game object / prefab's pivot point in the editor which actually saves across unity editor sessions??
     
  16. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    6,305
    No.
    Technically, the pivot point isn't a thing. It is always 0,0,0. Children are offset from that. Meshes are a collection of points (verts and other things like bones) that are positioned relative to the zero point.

    As said above you can nest it in a parent and move it inside that. For meshes, you need to go into a 3D app and adjust it there. (There is no reason it should look any different from the original, unless you changed something else or exported incorrectly).

    You could write an editor script that reads the Mesh and offsets the verts. Then save it as a new mesh object. But that could be problematic for animations, rigs and skinned meshes. And you would have to save it to a seperate object, you cant modify the source file from within unity. That just leads to other problems if you want to change the model in the future. There really isn't a need to do this, especially for changing an offset.

    So there are two options, parent it, or change the source. Everything else is just adding uneeded problems.
     
    Westland likes this.
  17. Kalladystine

    Kalladystine

    Joined:
    Jan 12, 2015
    Posts:
    227
    For other users sake, it might be good to contact the creator of the asset. It can probably be solved pretty quickly by the person who originally made it and you won't have the issue anymore.

    And if that person is not interested in fixing it, leaving a review at the asset store for it warning about the issue might be warranted - worst case it will benefit potential buyers that don't have the knowledge on how to fix it, best case the creator will be then motivated enough to do something about it.
     
    filibis, Westland and zombiegorilla like this.
  18. Amoldadu

    Amoldadu

    Joined:
    Feb 3, 2017
    Posts:
    1