Search Unity

Change the pivot point of a Unity primitive (Cube, Sphere etc)

Discussion in 'Getting Started' started by MlleBun, Oct 20, 2018.

  1. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Hello everyone,

    Is there a way in Unity editor to simply change the pivot point of a cube or sphere (without adding a parent locator or using third-party tools I mean). I would like th pivot to be at the base of the cube, instead of being centered.

    Thanks a lot!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    No. Stick it in a parent object; that's how it's done.
     
  3. MlleBun

    MlleBun

    Joined:
    Sep 19, 2017
    Posts:
    163
    Thanks for replying JoeStrout, that's what I finally ended with. Or import a obj with the right pivot.
     
    JoeStrout likes this.
  4. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    @JoeStrout is correct. That is the most common way to fix an issue like that and it can usually be done without problems, just move the scripts for movement and rotation to the parent object.

    You also mentioned a second method and that's what I normally do. I import into Blender set my pivot and export back out as FBX (unity's native format). In Unity there is nothing more to do. Blender wants to save with Z as up so make sure you set the save orientation properly.

    There is now a new way to do this and right in Unity for free. ProBuilder is now part of Unity and by using it you can set the pivot. Use ProBuilderize on any object, set its pivot, and export back into project. ProBuilder has it's limitations but it also has some amazing tools. It's really nice to not have to leave Unity to do some simple modding or mockups.
     
    MlleBun and JoeStrout like this.
  5. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    I'm such a noob with Blender I am considering animating a few robots using parents and their pivot points, so I can scream and curse at blender at a later date modelling the robot's individual parts. I prefer Unity as an animation tool.

    Provided that I do not need bones, is there a performance reason why I shouldn't? Can I still blend animations based on Animators?

    Edit: Scratch that idea. By default Unity will recalculate pivot points of Empty Objects as well as primitives based on their contents.
     
    Last edited: Jan 20, 2020
  6. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Yea, Blender is a total nightmare to use. Somehow many people have adapted to it's wacky interface and have actually created great things with it, I'm not one of them. There are alternatives, but modeling in 3D is an art and it takes a while to become good enough to create something usable.

    Unity is not an animation tool. It's animation toolset is not more full featured or more robust that others. It's more of a convenience utility. It also relies on a skeletal system for animating multiple mesh objects and skinned meshes. But yes you can blend animations. I kind of think you're trying to needlessly reinvent the wheel. Learning proper animation techniques will move you farther ahead.
     
  7. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    What? It does no such thing. In the Scene view, you can switch between manipulating objects by their actual positions and manipulating them by their geometric centers. But the latter is strictly a convenience for the Scene view; at runtime, from the point of view of code, there is no such thing. Every object simply is where it is, and its children are where they are (fixed in local coordinates unless something changes them).
     
    Inxentas likes this.
  8. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Oh yeah I agree. Animation just isn't my strongsuit (I have more of a programming background) and I am used to Cinema 4D. Plenty of things to cry about with Cinema but I find it's UI to just be more intuitive then Blender.

    The fact that it survives comparison to other keyframing tools is exactly why I regret the pivot point thing. Ever heard of Ecstatica? I'd love to make a spiritual successor with modern rendering techniques.
     
  9. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Wow thank you! I noticed that from a code point of view pivot points are respected but not in the editor and didn't realize this. Now I regret deleting the character I was working on, and feel quite stupid with that center / pivot button staring me in the face. That's the one you're talking about right?
     
  10. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Yep, that's the one. I can never remember which is which, but I know to smack it if things are acting weird. :p
     
    Inxentas likes this.
  11. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Works like a charm now, thanks!
     
    JoeStrout likes this.