Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by ro-ca · Jan 16, 2020 at 08:20 AM · quaternionrotatelookatrotate objectlookattarget

How to rotate an object depending on the rotation of an other Object

Hey guys, actually i´m facing the following problem. i have two components which i want to assembly. i have succsesfully implemented a virtually realty application which needs some improvements. so for example i have two technical components, which only could be assembled in one specific way. in my scenerio i have one main component and some assembly parts. so when im loading an assembly part into my Scene i want it to be in the right angle or assembly direction to my main component. in addition it should rotate as i rotate the main component. so the assemby part should always follow the right assembly position, but it should still stay at his own position. i´ve tried to implement this by using unity´s lookat or rotate function. but i didn´t get good results. maybe one of you has a good idea?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by AconitumNapellum · Jan 16, 2020 at 08:32 AM

Can't you just apply the same rotation to both objects? If you rotate the main component just apply the same exact rotation to the assembly part...

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
0

Answer by ro-ca · Jan 16, 2020 at 09:30 AM

Thanks for your answer! I tried: ObjectB.transform.rotation = ObjectA.transform.rotation; The rotation works fine so far, but ObjectB rotates around ObjectA. I want ObjectB to rotate around its own axes. So while i´m rotating ObjectA, ObjectB should rotate as well but not by moving around A. B should not loose its position.

Comment
Add comment · Show 5 · 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 AconitumNapellum · Jan 16, 2020 at 09:43 AM 1
Share

I believe you're looking for transform.localRotation, not transform.rotation. Just a guess, I don't know what your scene looks like.

avatar image ro-ca AconitumNapellum · Jan 16, 2020 at 10:58 AM 0
Share

Thanks again! I tried to use the rotation comment just with two cubes and it worked. So the actual problem I´m facing is that I converted cad files into .fbx, now I noticed that the pivot points of my converted objects are not centered in the middle of them. When I try to rotate my objects, they rotate around their pivot points. Is it possible to move the pivot point? Or to rotate around the center ins$$anonymous$$d of the pivot point? I appreciate your help!

avatar image AconitumNapellum ro-ca · Jan 16, 2020 at 12:53 PM 1
Share

I used to have a similar problem a while ago. I couldn't find a way to change the model pivot but i managed to solve it by parenting the 3d model to an empty gameobject positioned in the middle of the model, and then rotating the empty object ins$$anonymous$$d of the model itself. Hard to explain, hope you understand

Show more comments
avatar image
0

Answer by parmardarshanv · Jan 16, 2020 at 12:59 PM

By the details you explained in the comment, for the axis rotation you can implement ObjectB.transform.rotation = ObjectA.transform.rotation. If you want to rotate object A on a circular path around object B, the following video is the exact answer: https://www.youtube.com/watch?v=3PHc6vEckvc

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

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

124 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 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 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 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 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 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 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

2D look at 1 Answer

NavMesh agent won't rotate around Y axis 0 Answers

Problem with Quaternion.LookRotation() 1 Answer

rotate camera to face a specific object? 1 Answer

Merge a rotation(vector3) to a lookAt(quaternion) ? 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