• 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
5
Question by Muzz 1 · May 02, 2011 at 12:01 PM ·

Rotate around a point

So I'm writing a script, where I want a cube to orbit around a sphere. I want to use RotateAround, but that only works for when the object is at (0,0,0). So what can I do instead?

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 cregox · Sep 21, 2011 at 08:55 PM 0
Share

related: http://answers.unity3d.com/questions/25965/camera-orbit-on-mouse-drag.html

2 Replies

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

Answer by Kourosh · May 02, 2011 at 12:10 PM

I'm pretty sure you've used directly the example in scripting manual. Cause in that example for the first parameter which is "point" Vector3.zero is used. which you can sipmply replace it with the position of your sphere.

Comment
Add comment · Show 3 · 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 Muzz 1 · May 02, 2011 at 01:25 PM 0
Share

Thanks! I feel seriously stupid. I got it from another question, and didn't bother looking it up...

avatar image Kourosh · May 02, 2011 at 02:49 PM 0
Share

I'm sorry never wanted to make you feel that way. It happened to me before as well

avatar image Muzz 1 · May 02, 2011 at 04:46 PM 0
Share

Not bad, just amused at my own incompetence.

avatar image
7

Answer by dumytru · May 02, 2011 at 02:26 PM

put the script in here so I can see for sure ;)

well .. I think it's just like Kourosh sais , you probably used the script from the manual..

try using Rotate Around like this

//the sphere gameObject     
var sphereObject:Transform;      
function FixedUpdate()
{  
    transform.RotateAround (sphereObject.position, Vector3.up, 20 * Time.deltaTime);
}

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 Muzz 1 · May 02, 2011 at 04:46 PM 0
Share

Yeah, that's the script I've got.

avatar image Android324 · Nov 28, 2012 at 09:49 AM 0
Share

thank you; works for me

avatar image felixhcat · Oct 21, 2013 at 01:04 PM 0
Share

$$anonymous$$y god... here I was following this answer here... and it was so simple all along. Ugh.

http://forum.unity3d.com/threads/152215-Pivot-Rotation?p=1043155&viewfull=1#post1043155

avatar image Trys10Studios · Sep 09, 2017 at 02:19 PM 0
Share

So I feel like a noob (and despite my intellect, a complete idiot at times lol) still even after making a few games and using Unity for a few years lol. This was exactly what I needed for what I was trying to accomplish.

I was trying to get the camera to rotate about a fixed point while in "lobby" mode in my multiplayer game. Thanks!

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.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to import the object from server to unity 2 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

Material doesn't have a color property '_Color' 4 Answers


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