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 Divyang Metalia · Jan 27, 2014 at 10:59 AM · rotationaxisanglecube

Rotate cube in two direction not working

First thing, i want to rotate block left-right , right-left, top-bottom and bottom-top.

alt text

See figure-1 one cube is their and all axis. when i rotate top to bottom (black arrow) cube z angle changed (red arrow) and get figure-2 this all work fine.

see figure-2 after that i move left to right rotate (black arrow) cube x angle change but at this time rotation is wrong beacuse of after first rotation all axis changed. and result is figure-3.

see figure 3 i am getting this position and movement (see red arrow), but i want exact figure-4 that not getting me.

check code file and video file is link text ( in this video cube movement show and also show you true rotation and wrong rotation)

please help me solve this.

Thnx

imgb.png (85.2 kB)
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 Manco Capac · Jan 30, 2014 at 05:49 AM 0
Share

rotating through script works in local or global axis (im not sure which 1) so try both.

1 Reply

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

Answer by supernat · Jan 30, 2014 at 06:08 AM

It sounds like you want to use the Forward/Right/Down (FRD) coordinate system instead of the World coordinate system. Try using gameObject.transform.Rotate(someAmount, Space.Self). Because it rotates based on your model's coordinates (or FRD), rotating around the down axis (Z) will always move the cube left/right, rotating around the Right axis (Y) will always rotate up/down.

EDIT: Fixed my answer. Sorry about that, was thinking of parented rotations.

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 Divyang Metalia · Jan 30, 2014 at 11:48 AM 0
Share

@supernat done changes in code but not working properly.

avatar image supernat · Jan 30, 2014 at 08:11 PM 0
Share

@Divyang $$anonymous$$etalia Sorry, fixed my answer.

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

20 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

Related Questions

Character rotation on foot? 1 Answer

Angle between two rotation axis-vectors (illustration inside) 2 Answers

Creating a multiple part turret what locks onto certain axis. 4 Answers

90 Degree stopping rotation on y-axis issue 0 Answers

transform.lookat axis switch during rotation 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