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 alexanderameye · Jan 08, 2015 at 04:35 PM · rotationrotateeuleranglesrotatingrotate-around

Is 360° the same as 0°?

I have an object that I want to rotate around a parent object. So it would be something like this (see picture).

http://prntscr.com/5pz2kd

So I'll need to rotate the parent in order for the object to rotate around it. If i set the initial rotation to be 'InitRot' and I set the new rotation to be 'InitRot + 30', the object will rotate clockwise with 30 degrees. Now if I want the object to rotate 30 degress to the left, I would do 'InitRot + 330' thinking that it will rotate counterclockwise, but it will not, it still rotates clockwise. Now the question is, can I change this by saying: 'InitRot = InitRot + 360', so that the object will be in the same position, but will have a different value. So that then when I set the new rotation to 'InitRot - 30', the object will rotate counterclockwise.

Or could I just do 1) new rotation = Initrot + 30 for clockwise rotations 2) new rotation = Initrot - 30 for counterclockwise rotations

Tyvm!!

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 reddead12 · Jan 08, 2015 at 05:28 PM 0
Share

Basicly yes, but in certen cases it also isn't. If you are in editor and you fill in 360° at rotation while 0° was previus then it dosen't matter.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Anxo · Jan 08, 2015 at 04:45 PM

It all depends on what method you are using to rotate.

You do not have to rotate the parent if you do not want to, you could use http://docs.unity3d.com/ScriptReference/Transform.RotateAround.html

Or you could use transform.eulerAngles in connection with a http://docs.unity3d.com/ScriptReference/Vector3.RotateTowards.html which would allow you to specify the specific rotation you wish to achieve and allow the system to pick the shortest path.

You could use tarnsform.Rotate or transform.rotation in which case you would have to use Quaternions which can be more complicated to deal with.

I recommend transform.eulerAngles with RotateTwoards, for easiest and most predictable results.

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 alexanderameye · Jan 08, 2015 at 04:55 PM 0
Share

Hey, I don't have much time right now to test these out, but I think one of your methods will most certainly solve the problem! Thank you so much!

avatar image
0

Answer by Owen-Reynolds · Jan 08, 2015 at 05:26 PM

Yes. Your logic is correct. For example, +330 is the same as -30 for (Unity) rotations.

The only time this doesn't work is if your code is doing other odd stuff. For example, some hidden part of your code is snapping it to -180 to 180.

I think most odd errors are comparing rotations with an "off by 360" issue. If you set rotation to 10, then set it to 371 next frame, it will correctly appear to rotate 1 degree. But if you Lerp it from 10 to 371, it will go through all the numbers, making a full spin plus 1 degree.

Reading a value back from a rotation can do this: you set to +190, then read it (eulerAngle) back and get -170. If you just add 1 and set it again, that's fine. +191 and -169 are still the same. But, again, sometimes you then try to move that -170 up to a new +191. Or you increase until it gets to 200 (which will never happen.)

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

28 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

Related Questions

How do I call a function containing a while loop, inside the update function? 2 Answers

How can i rotate the aircraft elevator around the yellow axis up and down ?? as shown in the pic 0 Answers

Reversing rotation back to zero 0 Answers

Object wont rotate in the opposite direction 1 Answer

Strange rotation pattern. 0 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