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 TomDanes87 · Feb 24, 2014 at 01:41 PM · rotationtransformquaternion

Opposite angle rotation

I have an object I would like to rotate around Y axis. I'd like the object to rotate the same direction of the twist movement of the fingers

![Like This][1]

At the moment I am using FingureGesture to deal with touch events.

However when I set the rotation around the Y axis currently the following happens:

![Like This][2]

 void OnTwist( TwistGesture gesture )
     {
         // rotate around current rotation axis by amount proportional to rotation gesture's angle delta
         Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
 
         // apply rotation to current object
         transform.rotation = qRot * transform.rotation;
     }

Is there a simple way to reverse the angle?

I have tried Quaternion.Inverse, but no luck.

Thanks [1]: /storage/temp/22695-correct.png [2]: /storage/temp/22696-current.png

current.png (108.7 kB)
correct.png (93.5 kB)
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 robertbu · Feb 24, 2014 at 04:22 PM 0
Share

This line won't compile. Are you talking about Quaternion.AngleAxis(). If so, can't you just negate either the angle or the axis in the call?

    Quaternion qRot = Quaternion.axis Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
avatar image TomDanes87 · Feb 24, 2014 at 06:38 PM 0
Share

Sorry my bad, that should have been:

 Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, GetRotationAxis() );
 
avatar image robertbu · Feb 24, 2014 at 06:43 PM 0
Share

So interpreting drawing is always dicey. Do either of these work for you:

 Quaternion qRot = Quaternion.AngleAxis(-Sensitivity * gesture.DeltaRotation, GetRotationAxis() );

Or:

 Quaternion qRot = Quaternion.AngleAxis( Sensitivity * gesture.DeltaRotation, -GetRotationAxis() );

Both should produce the same rotation.

avatar image TomDanes87 · Feb 24, 2014 at 07:12 PM 0
Share

You legend, the top one sorted it. And i've been pulling my hair out for the last day over something that now seems so simple

0 Replies

· Add your reply
  • Sort: 

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

19 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

Related Questions

Get slerp to work just as LookAt(,Vector3.right) does 1 Answer

Boids for 2D 0 Answers

How to use quaternion.lerp 2 Answers

Rotate object without storing facing 1 Answer

Player forward in Kinect 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