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 limonad76 · Feb 09, 2012 at 09:41 AM · rotatearoundorbit

Transform.RotateAround axis calculation

alt text

I would like to use function RotateAround (point : Vector3, axis : Vector3, angle : float) : void for orbiting script for simple 3D orbiting :) Can anyone suggest an algorithm for calculation of Transform.RotateAround axis : Vector3 so that the orbital plane passes through the point : Vector3? I find solution for cases where orbital object belongs to the axis but confused when all of its position coordinates != 0.

3D orbiting scripts will be appreciated too :)

Comment
Add comment · Show 3
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 asafsitner · Feb 09, 2012 at 10:46 AM 1
Share

What if you make a rig for it?

Have one game object as your center and another at the end point you wish the orbit plane to pass through.

Then point the center object at the end point (`LookAt` can come handy, but only has to do it once so it kind of 'snaps' into place) and rotate it around it's own Y axis (`centerObject.Up` to be more precise).

$$anonymous$$ake the orbiting object a child of the center object or make it follow a child of the center game object (that would need to be positioned at the desired orbit distance away from the center object of course).

avatar image limonad76 · Feb 09, 2012 at 10:58 AM 0
Share

If i have several orbiting objects so I need personal GameObject center for each other :) It's not a problem, but may be there is some elegant solution :)

avatar image limonad76 · Feb 09, 2012 at 12:45 PM 0
Share

Also I am not sure that the parent-child rig could rotate around the parent object but not around the "center mass" :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sgmongo · Feb 09, 2012 at 03:07 PM

Well there are two differing ways I can imagine this working.

The hard way would be to restructure the parent-daughter relationship of the objects and only rotate the parent. That's honestly a cannonball-to-kill-a-fly approach though.

I would suggest using a Quaternion.Euler. Basically setup the pivot location as a quaternion and apply a Eular style change in rotation to the group as a whole.

Something like:

Game object A = Pivot Point 1 Game object B = Pivot Point 2

Both game objects are parented to a master object.

Create a quaternion.eular change based on the positions and apply the results to the master object.

It seems to be the smartest way I can think of, without disrupting your programming too much.

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 limonad76 · Feb 09, 2012 at 05:00 PM 0
Share

I hope to find solution for RotateAround :) I'm sure that's not a problem :)

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

6 People are following this question.

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

Related Questions

Rotate around object then leave at realistic angle 0 Answers

How to rotate a player when using Mario Galaxy style gravity? 5 Answers

Change orbit while rotating. 2 Answers

Joystick Rotation with Transform.RotateAround 0 Answers

Translating Speed into rotation degress\sec 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