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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Kartik1607 · Dec 13, 2014 at 05:14 PM · rotationrotatearoundexplain

RotateAround explanation.

Can anyone explain me what is and how to use third parameter in RotateAround (angle).

Example image

How I think RotateAround works.

 transform.RotateAround (target.position, new Vector3 (0, 1, 0), 90 * Time.deltaTime);

First parameter is the position around which we want the sphere B to rotate, so in my case it will be position of my Cube.

Second parameter is the axis around which it should rotate. Since it is (0,1,0), it will rotate around Y axis.

Third parameter is something I don't know and/or understand. What is angle? If it is rotating then what is the work of angle. Even if I put 180 instead of 90, there is visually no difference.

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 cariaga · Dec 13, 2014 at 05:38 PM 0
Share
 var angle =5F;
 transform.RotateAround(Vector3.zero, new Vector3(0F,1F,0F), angle);

it seems that the angle acts more like a speed increment-er rather that getting the angle based on the targets position

avatar image Ericool · Dec 13, 2014 at 05:55 PM 0
Share

Of course Time.deltaTime is tiny .

2 Replies

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

Answer by Bunny83 · Dec 13, 2014 at 05:38 PM

RotateAround does one single rotation around the given center point and axis by the amount specified in the third parameter. So if you call this once:

 transform.RotateAround (target.position, new Vector3 (0, 1, 0), 90);

It would rotate the sphere around the cube by 90°. However if you call this method in Update, which means it's being called each frame (at 60fps == 60 times per second) rotating by 90° wouldn't make much sense as each frame it would be rotated 90°. So the given parameter specifies the speed how fast it rotates. Since the frame rate can vary you would get different speeds on different platforms / PCs /... By multiplying with Time.deltaTime you make the speed frame independent and the speed becomes time-dependent (like we usually measure speed, distance or angle in a certain amount of time).

 90*Time.deltaTime

This actually returns a fractional angle which is modified for the current framerate so if you accumulate those fractions they will add up to 90° after 1 second. So you have a rotation speed of one (360°) rotation in 4 seconds or 15 rpm.

When you use 180 instead of 90 it should rotate twice as fast.

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
6

Answer by chelder · Jun 10, 2016 at 03:04 PM

It was hard to understand how it works. The Unity documentation did not help me much (I asked about what confused me here)! I have drawn a picture I hope it helps to visualice to you all:

explanation draw

So if you change the angle, you will change the position within the green drawn circle...


20160610-164906.jpg (446.1 kB)
Comment
Add comment · Show 2 · 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 Le-Pampelmuse · Jun 10, 2016 at 03:33 PM 0
Share

I don't know what you tried tro link here, but it isn't a documentation page. ;)

The documentation link would be:

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

avatar image chelder Le-Pampelmuse · Jun 10, 2016 at 03:41 PM 0
Share

Changed. 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

7 People are following this question.

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

Related Questions

easing a rotation of ROTATE AROUND 1 Answer

rotate around character 1 Answer

Character Rotation Now Matching GameObject's Local Rotation 0 Answers

Rotate Around Planet with Spaceship Face Set on Path 1 Answer

Rotate within range 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