0

I am creating a game in Unity 3D. In the game scene I am dynamically creating GameObjects, one of which is a building. I would like to change the pivot of the building to be at the center of the base of the building, this way when I instantiate this GameObject, I can set it's position to (0, 0, 0) and it will make it easier to instantiate object within the building.

Is there a way to move my pivot point to the center of the base of the GameObject so that I can do this?

sabo
  • 911
  • 13
  • 37
  • You cannot change pivot of mesh, but you can put this building object inside other, and play with localPosition of building and position of its parent to have result you look for. – Jerry Switalski Jan 21 '16 at 18:01

1 Answers1

0

Wrap it in a parent object (and make that parent object the prefab). That's the only way.

  • So are you saying I set the building to (0, 0, 0) and then throw it in an empty gameobject and move that parent object until the building looks to be okay? – sabo Jan 21 '16 at 18:26
  • Not quite. By creating a parent/child relationship you can position the child object relative to the parent such that the parent acts as your altered pivot point. e.g. if the pivot of the building is in its geometric center, but you wish to manipulate it from the bottom center (so that regardless of how tall each building is, they area all placed at the same Y coordinate) you add a parent object that has its center at the bottom, then initiate the parent-child relationship. The parent is now the pivot you desire. – Draco18s no longer trusts SE Jan 21 '16 at 18:32