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 $$anonymous$$ · Oct 04, 2014 at 06:09 PM · transformvector3rotatetransform.rotateinconsistent

Rotating Transform Evenly

I have the following FixedUpdate() method on a game object:

 void FixedUpdate()
 {
     transform.Rotate(Vector3.right * Time.deltaTime);
     transform.Rotate(Vector3.up * Time.deltaTime);
     transform.Rotate(Vector3.forward * Time.deltaTime);
 }

However, the x rotation, y rotation, and z rotation are all rotating unevenly. What causes this and how can I fix it?

Additional Information:

  • Same results for both a 2D sprite and 3D cube.

  • The order of the Rotate() calls have no effect.

  • The x rotation rotates substantially slower than the y rotation and z rotation.

  • The y rotation and z rotation stay relatively the same.

  • transform.Rotate(Time.deltaTime, Time.deltaTime, Time.deltaTime); yields the same results.

Comment
Add comment · Show 4
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 $$anonymous$$ · Oct 04, 2014 at 06:22 PM 0
Share

If i rotate it 360 degrees on the x, 360 degrees on the y, and 360 degrees on the z, I want it to actually rotate the 360, and return to its starting position. (All at the same time.)

avatar image robertbu · Oct 04, 2014 at 06:30 PM 0
Share

Still not sure what you want. For example if you do this:

 void FixedUpdate()
 {
     transform.Rotate(Vector3.right * 360.0f);
     transform.Rotate(Vector3.up * 360.0f);
     transform.Rotate(Vector3.forward * 360.0f);
 }

Or this:

   transform.Rotate(360.0f, 360.0f, 360.0f);

The cube will be at the start position (within a bit of floating point imprecision).

Note you may also have issues with the difference between local rotation and world rotation. Not sure, but take a look at the optional last parameter to Transform.Rotate(). I think you have a vision in your head of what you want, but we need to have a clear description in order to give you guidance.

avatar image $$anonymous$$ · Oct 04, 2014 at 06:34 PM 0
Share

that makes it rotate evenly, but now very very slowly...my problem is, if I just rotate by Vector3.one, then why isn't it rotating at the same speed on all axises? (It is more than floating point imprecision). And no, unfortunately the Space did not fix the problem.

avatar image $$anonymous$$ · Oct 04, 2014 at 06:50 PM 0
Share

@robertbu ive tried just about every possible combination. Even the transform.Rotate(360.0f, 360.0f, 360.0.f); yields the same result of the x rotation happening slower. (Just not as obvious due to the extreme overall slowness of the rotation.) Specifically, what I am trying to do, is rotate a game object around its x axis, y axis, and z axis simultaneously. I want them to start at the same time at a rotation of 0, 0, 0. I want them to end at the same time with a rotation of 90, 90, 90.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Oct 04, 2014 at 06:20 PM

Your code here rotates by 1 degree on the local x, y, and z axis each frame. It is the same as:

 transform.Rotate(1.0f, 1.0f, 1.0f);

Your use of Vector3.right/up/forward here is strange since these vectors are directions, and Rotate() takes angles. You need to specify what you want to happen for someone to give you alternate code.

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

26 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

Related Questions

unknown axis of rotation 1 Answer

Setting Up Vector and Still Rotating the Character 1 Answer

Rotate Around Object 2 Answers

How to prevent Z axis rotation ? 0 Answers

Vector3 precision issue? 2 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