Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Yoeri · Feb 03, 2013 at 02:20 PM · rotaterotatearoundlocalrotationxyz

problem with the rotation of an object

Let me describe the project first. We intent to create a program that loads molecules (in a simplified way) from a xml file.

The rpoblem lies that after creating the first atom, the second atom needs to be rotated AROUND the first. But, this sounds easier than it is, as RotateAround happens on the world axis. The problem is multiplied by the fact that each object (after it's rotated), creates more objects (attached to itself), that all need to be rotated in a similar way. The scripts that handle the rotations are: -scr_generate, this generates the ' balls' -scr_mono, generates 1 child object -scr_duo, generates 2 child objects -scr_trio, generates 3 child objects -scr_tetra, generates 2 child objects

In the link provided, the (nearly whole) project is there, after starting the following functions can be used to manipulate the camera and the view: left mouse rotates the molecule, right mouse moves the camera, the scroll wheel, surprisingly, zooms in and out. The menu on the left is sorted in the following order: hide menu, create molecule (not working (yet)), load molecule, information (in dutch), take screenshot, and quit.

The questions comes down to: How do we rotate objects around another object (parent) using the parent's local xyz axis?

If we should provide more (or less) information on something, please ask us.

We thank you in advance,

Here's the link: https://www.dropbox.com/s/juqahamn320gciu/unity.rar

Comment
Add comment · Show 2
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 Vonni · Feb 03, 2013 at 03:15 PM 0
Share

You could create prefabs of the atoms, with the atom itself linked to a connection point somewhere along one of its axis and then instantiate it at the atoms position,rotation. Link it and then have full control of its rotation in its localrotation? Very simple solution, probably not what you want :P

avatar image HarbingerOfMe · Feb 03, 2013 at 03:49 PM 0
Share

How would you suggest we find out where the position of the atom should be? Because currently, we are letting RotateAround handle that. I thought about prefabs before, but I couldn't figure out how to do the positioning. The atom is simple primitive sphere, while it's childeren are cylinders.

Oh, and I forogt to say, I'm the other part of the 'we' he mentions.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Wolfram · Feb 03, 2013 at 04:31 PM

You should be fine by using the parent's local coordinate axes, instead of the the world space axes, i.e., obj.transform.right instead of Vector3.right, and so on:

 attach1.transform.RotateAround(obj.transform.position,obj.transform.right,0);//x

I suggest doing a tutorial about Transform hierarchies and local coordinates, it should help your understanding of these situations.

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 HarbingerOfMe · Feb 03, 2013 at 08:42 PM 0
Share

This solved most of the problems, so I thank you.

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

12 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

Related Questions

Rotate object around local Z axis 1 Answer

Camera Orbit Rotation Problem 0 Answers

transform.rotate only 1 time for 180 degrees? 1 Answer

How do I rotate an object around another to have its opposite ? 0 Answers

I want to use LookAt but based on the object original rotation 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