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
2
Question by eube · Jun 18, 2012 at 03:08 PM · rotationsource

Gimbal Lock fix

hey !

I come here cause I have a question about gimbal lock and you guys seems to talk a lot about it. But i'm not on unity but it doesn't change much

I've recently got a kinect, I pluged it into my pure data so I get XYZ translations of the points that mal my skeleton.

what I want is to convert it into angles.

So I made a simple algo with trigonometry wich gives me in degree from à to 360 in X Y Z rotation of my left arm. Now when I apply it to a cube it's kind of weird. After looking a while online I found about the Gimbal Lock, so I adapted a fix in C to PureData.

The result is still buggy so I guess I did something wront.

Could someone tell me what following rotations he get after gimbal fix for

X 160 Y 90 Z 267

with Y to be the base

I get

X 0 Y 90 Z 106

I attached my PD patch in case of

link text

[1]: http://answers.unity3d.com/storage/temp/1291-gimblekill.pd.txt

gimblekill.pd.txt (6.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 frogsbo · Jan 21, 2014 at 07:30 PM 0
Share

Unity3d should take care of this, or someone should, seeing as it is a complex matrix that makes 100ds of developers ask questions and make code faliures

there should be an XYZ "wrapper" for unity that simply applies proper maya type rotation maths to a gameobject, i.e. it resets order of xyz axis rotation when 2 axes are close to a lock alignment.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Cokemonkey11 · Jun 18, 2012 at 03:16 PM

I'm quite new here so my answer might not be useful, but a bad answer is better than no answer I guess.

Try quarternions. I don't really know how they work yet but you can use them in place of angles to avoid gimbal lock (which I also don't really understand yet)

http://unity3d.com/support/documentation/ScriptReference/Quaternion.html

http://en.wikipedia.org/wiki/Quaternion

I hope this helps!

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
avatar image
0

Answer by ebkc · Jun 18, 2012 at 03:53 PM

Hey !

yeah it's what I'm already doing :)

and that's my question, is my quaternion transformation right.

In the meantime I found out that non when I compare my results to others on a calculator (euler/quaternion).

The part wich is wrong is calculation of RX in case of gimbal lock

this part :

 RX = ((sin_X*sin_Y)*sin_Z)+(cos_X*cos_Z);
 RY = (-(sin_X*sin_Y)*cos_Z)+(cos_X*sin_Z);
 
 Z = Math.atan2(RY,RX);
 Z *= RADIANS;

if anyone can correct me would be great

thanks

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Is anyone able to fix my code? 3 Answers

An object reference is required for the non-static field, method, or property 1 Answer

Character Not Rotating 0 Answers

C# Unity 3D Lock Rotation but allow Rotation of Parent Object 1 Answer

why update function doesn't work on the transform.Rotate function 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