Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
22
Question by abdullah.ahmed · Nov 01, 2009 at 04:18 PM · graphicspivot

Changing the pivot point of meshes.

New to Unity and 3d graphics 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
Add comment · 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
17
Best Answer

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

This guy wrote an editor script to allow the user to edit an object's pivot location. Currently it's limited to within the object's bounding box, but he says this is fixable.

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

Comment
Add comment · 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=Pivot$$anonymous$$anager 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/Pivot$$anonymous$$anager

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

Thank you Ben Throop awesome answer

avatar image
8
Best Answer

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

As far as I know, this is not possible within the editor. It may be possible to do this with scripting and in that case you might be able to write some sort of editor script that does this for you - but in general, I think the best solution for this 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 this is something that usually an artist would do, I think it's even more efficient to do it in the modelling tool (as the artist will usually know how to do it there).

Comment
Add comment · 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
39

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
Add comment · 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 $$anonymous$$VP 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
9

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
Add comment · 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
7

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

I'm terrible at describing things, 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 this 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;

         //This will rotate around the x, you would need to change this
         //to whatever axis the tank follows
 scriptText.transform.RotateAround(pivotTransVector, Vector3.right, rotateValue);

}

}

Hope this helps a little

Comment
Add comment · 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.

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

Does using "half res" in the quality settings reduce texture RAM usage? 1 Answer

Android device graphics problem !!! 1 Answer

Unity equivalent of ARB_occlusion_query (glGetQueryObject)? 0 Answers

Why does my game require so much rendering power? 1 Answer

Does Unity support NVIDIA frame synchronizing technology? 1 Answer


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