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 iron_attorney · Jun 12, 2015 at 11:03 AM · rotationeulerangleschildrenquaternions

Rotation Complications + rotation with parents and children?

Hi there, I have been trying to make objects rotate in a variety of ways. I am working on a scene in which the user can construct something out of a variety of prefab game objects. This involves being able to move, scale and rotate the objects, much like you do in unity itself. I have stumbled across two problems doing this (one of which I have got stuck on in another scene).

Problem 1: I think this is a standard problem, but when using eulerAngles, the rotations glitch out like crazy. It is impossible to rotate past 90 degrees in certain rotations, and rotating in certain axis buggers up other axis. I understand there is a problem wwith eulerAngles due to the translation between the quaternions and the eulers. I have also experimented with the quaternianEuler, but I can't see how that is any different to using eulerAngles. Is there any way to stop the eulerAngles glitching out or do I need to start learning how quaternions work?

Problem 2: I want to be able to point mmy object in any direction, and then be able to rotate it on an axis based on the direction in which it is facing, just like if I was making a space sim and wanted to roll the ship (which I am, and I also can't get that to work properly, haha!). I have read a million unity answers pages and looked through countless tutorials, but I can't seem to find anything that works properly.

My current solution to this is to have a parent layer which points the object in the correct direction, then a child layer which holds everything in the object, and use the child layer for local rotation, ie rotating the object around axis based on the direction it is facing. This feels to me like unnecasary clutter though, and I'm sure there must be a better way. I am also wondering if having the extra child with it's own transform merely for extra rotation will add any extra cpu strain, bearing in mind I intend for the user to be able to add as many of these building blocks as the computer can handle.

Sorry about the essay, any thoughts on this would be much appreciated. Cheers in advance,

Pete

Comment
Add comment
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

1 Reply

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

Answer by iron_attorney · Jun 12, 2015 at 03:54 PM

Ok sorry, I've totally sussed this out, using:

transform.rotation = Quaternion.AngleAxis(1, transform.forward) * transform.rotation;

it was a piece of cake once I found the correct quaternion function. I've already managed to implement this on my space sim aswell, got roll pitch and yaw all working. Awesome!

Pete

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

21 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

Related Questions

Trouble Spawning Bullets with proper rotation 0 Answers

How do I make transform.Lookat use Vector3.down instead of Vector3.forward? 1 Answer

Gyro Sensor based on Euler angles? 0 Answers

Rotating child object around X and Z from different angles causing issues 2 Answers

Object deforms with 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