• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by abdullah.ahmed · Nov 01, 2009 at 04:18 PM · graphicspivot

Changing the pivot point of meshes.

New to Unity and 3d grap$$anonymous$$cs here so bear with me as I try to ask what likley amounts to a really silly question

I have a tank model who's turret I am trying to rotate, however its pivot point is not set correctly so the turret rotation seems off.

I know for transformation you can set the Pivot to center of the mesh or to the actual pivot point, but is it possible to change the pivot point ourselves inside Unity Editor?

Comment
AngryAnt
Lucas Meijer 1
jashan
tasbar
Ricardo
fzzr
ericksson
FrHaYwOrKs
EytanTKing
cregox
JustinC
idiot333
birdypme
TheFloatingSheep
Ihabbalakho
And 7 more...

People who like this

22 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image daviddickball · Nov 17, 2014 at 08:30 PM 1
Share

Hey guys is this still true?

12 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Ben Throop · Jan 17, 2010 at 03:00 AM

T$$anonymous$$s guy wrote an editor script to allow the user to edit an object's pivot location. Currently it's limited to wit$$anonymous$$n the object's bounding box, but he says t$$anonymous$$s is fixable.

Link: http://solvethesystem.wordpress.com/2010/01/15/solving-the-pivot-problem-in-unity/

Comment
abdullah.ahmed
Ricardo
pyro
ericksson
EytanTKing
billybombill
Tea_Doogun
briosh
vmvenkat
birdypme
rahul.tantry
Timofey236
Sajalsh25
marcobeck
40detectives
And 2 more...

People who like this

17 Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abdullah.ahmed · Jan 17, 2010 at 10:19 PM 0
Share

Awesome. Thanks

avatar image cregox · Jun 06, 2012 at 08:22 PM 3
Share

I hope this script helps someone else: http://unifycommunity.com/wiki/index.php?title=PivotManager I tried to simplify that VoxelBoy's original SetPivot for my own understanding of it.

avatar image Bunny83 cregox · Jan 20, 2017 at 03:29 AM 0
Share

New wiki link is:
http://wiki.unity3d.com/index.php/PivotManager

avatar image hanzala717 · Sep 22, 2017 at 07:40 AM 0
Share

Thank you Ben Throop awesome answer

avatar image
Best Answer

Answer by jashan · Nov 01, 2009 at 10:23 PM

As far as I know, t$$anonymous$$s is not possible wit$$anonymous$$n the editor. It may be possible to do t$$anonymous$$s with scripting and in that case you might be able to write some sort of editor script that does t$$anonymous$$s for you - but in general, I t$$anonymous$$nk the best solution for t$$anonymous$$s is using a modelling tool. Given the smooth asset pipeline in Unity, that's usually "almost as efficient" as if you would be doing it inside Unity itself. And ... given that t$$anonymous$$s is somet$$anonymous$$ng that usually an artist would do, I t$$anonymous$$nk it's even more efficient to do it in the modelling tool (as the artist will usually know how to do it there).

Comment
Lucas Meijer 1
Bampf
tasbar
EytanTKing
JustinC
birdypme
Alatza
40detectives

People who like this

8 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abdullah.ahmed · Nov 02, 2009 at 03:30 AM 1
Share

Thanks for the clarification. I currently don't have any 3d modeling knowledge but I should get that soonish.

avatar image

Answer by Martin Schultz · Nov 03, 2009 at 02:40 PM

It's yet not possible to set the pivot directly in the editor. Only way around is to attach your object to a new gameObject and set the your object's local transform in relation to its new parent so that the pivot gets moved.

Comment
AngryAnt
Bampf
PatHightree
Jean-Fabre
JakeBryn
FrHaYwOrKs
EytanTKing
wccrawford
jorgon
albertwang
APProjects
ShawnFeatherly
idiot333
Logan76667
stuyam
And 24 more...

People who like this

39 Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image stuyam · May 08, 2015 at 05:11 PM 0
Share

This worked perfect!

avatar image Waltari · Jul 05, 2016 at 07:37 AM 0
Share

How to do this in practice? Do you have to script or something or can you do it in editor?

avatar image ludo6577 · Jan 19, 2017 at 11:59 PM 0
Share

This should be the accepted answer

avatar image Bunny83 ludo6577 · Jan 20, 2017 at 03:28 AM 1
Share

No it should not for several reasons:

  • First of all it's not your question but the question of abdullah.ahmed and he decides that Jashans and Ben Throobs answer answers his question.

  • This answer, even it's of course the most used workaround, does not really solve the problem of moving the pivot point. There are more reasons why you need it at a different position. For example a shader still get the local vertex positions of the original mesh. It's just the MVP matrix which projects the vertices to their final position based on the Transform hierarchy. However if you need proper local coordinates you have to actually change the local positions of the vertices.

  • Ben Throob and Jashan do provide the proper answers to the actual problem. In short: It's not possible out of the box in Unity; It should be fixed in the modelling tool; Or you can use an editor script to fix it.

So while this answer clearly seems to be more helpful to most people, it's still the question of abdullah.ahmed.

avatar image

Answer by venkspower · Nov 25, 2011 at 12:35 PM

It is not possible in the editor. Instead set an empty GameObject, and apply a box collider for that. And make that the parent object. And then try to rotate. But set the position of the object correctly. And adjust the scaling size to 1:1:1.

It may probably help you.

Comment
jorgon
doburu
li3ro
Captain-Awesome
Rosehardt
GToma
BKZ444
Timofey236
40detectives

People who like this

9 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by LifeSizeDeity · Aug 06, 2010 at 06:17 PM

I'm terrible at describing t$$anonymous$$ngs, so I'll just give a code snippet. The long and short of it is, use transform.RotateAround function.

public class RotateAroundObject : MonoBehaviour {

private GameObject torret; private GameObject tankPivot;

private float rotateValue = 0;

Vector3 pivotTransVector;

// Use t$$anonymous$$s for initialization void Start () { torret = GameObject.Find("torret"); tankPivot = GameObject.Find("tankPivot");

 pivotTransVector.x = tankPivot.transform.position.x;
 pivotTransVector.y = tankPivot.transform.position.y;
 pivotTransVector.z = tankPivot.transform.position.z;

}

// Update is called once per frame void Update () { //Just an incremented value to rotate by rotateValue += Time.deltaTime;

         //T$$anonymous$$s will rotate around the x, you would need to change t$$anonymous$$s
         //to whatever axis the tank follows
 scriptText.transform.RotateAround(pivotTransVector, Vector3.right, rotateValue);

}

}

Hope t$$anonymous$$s helps a little

Comment
CupOfJoe
ericksson
FrHaYwOrKs
EytanTKing
doug__
sor_marchese
winf_randy

People who like this

7 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CupOfJoe · Aug 18, 2010 at 05:05 PM 0
Share

RotateAround is the key.

function RotateAround (point : Vector3, axis : Vector3, angle : float) : void

"point" is where your pivot point is. If you're not sure, you can create a small object and drag it to where you want and use the Inspector to get the coordinates. Put the coordinates in your code and delete the object.

  • 1
  • 2
  • 3
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

unity basic - island water (from the demo) - adjusting alpha 1 Answer

How do I generate mipmaps at runtime? 4 Answers

How can I draw an array of data (640x480) very fast ? 5 Answers

NAVTEQ 3D Map Data 2 Answers

importing 3ds max terrain 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges