• 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 /
This question was closed Aug 19, 2013 at 01:38 PM by Fattie for the following reason:

Duplicate Question

avatar image
0
Question by osisdie · Aug 19, 2013 at 06:00 AM · rotateoffset

rotate a 3d object from tail instead of center position

I'm simulating a tank with a gun, which is red one and white one respectively. Moreover, there is a player nearby. So I wanna have this tank's gun "lookat" the player, rotating gun's tail as a axis. But as the picture shows below, the gun seems still rotate through its 3d center position. How can I fix it ?

Thanks a lot.

alt text alt text

gun1.jpg (9.1 kB)
gun.jpg (21.6 kB)
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 Fattie · Aug 19, 2013 at 01:37 PM 0
Share

use the critical RotateAround command.

simply glance to the doco and you would have seen it.

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Joyrider · Aug 19, 2013 at 06:03 AM

You can either change the pivot point's position in your modeling program (which I would recommend)

Or have a dummy at the gun's tail, where you want to turn around. and either rotate that, or use it as a reference.

Comment
Add comment · Show 9 · 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 osisdie · Aug 19, 2013 at 07:10 AM 0
Share

hi @Joyrider, dummy looks interesting and works. thanks! However, why you recommend to change the pivot point's position programmatically? Better for maintenance ?

avatar image Sajidfarooq · Aug 19, 2013 at 07:26 AM 0
Share

Not programmatically. Through your modeling "program", i.e, Blender, $$anonymous$$aya etc.

Good, concise answer btw. Up-voted.

avatar image Joyrider · Aug 19, 2013 at 07:47 AM 0
Share

Indeed, like Sajidfarooq specified, this should be done in your modeling program. Your objects' pivot point should always be placed at a strategic position, depending on your object's use.

Often, you should just think of the real object's mechanics, and place it at a hinge or, lack there of, a usefull referential point.

avatar image osisdie · Aug 19, 2013 at 11:38 AM 0
Share

got it. either the gun has placed in the correct relative location in 3d modeling software, or just have it placed under the dummy such as hinge or joint. thank you!

avatar image Fattie · Aug 19, 2013 at 01:38 PM 0
Share

Any answer here that doesn't mention

http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html

is crap. it's one of the most basic and handy functions in Unity.

question asked 18 million times, mods pls close dup questions

Show more comments

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

18 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 avatar image

Related Questions

Look to the side-Scripting Problem 2 Answers

Camera rotation around player while following. 6 Answers

rotate around character 2 Answers

Mouselook Is rotating Z-Axis of Camera Unexpectedly 1 Answer

How to let one gameObject move around another one in a certain radius? 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