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 Averius · May 31, 2015 at 08:13 AM · rotationeuleranglescoordinatesmotioncoordinate-system

Problem with rotation order of euler angles when importing MoCap data

I'm currently trying to display MoCap data from a Mocap-Suit in Unity 3D in realtime. The Suit SDK returns euler angles for each captured joint. I hoped that I could just take these Euler Angles and pass them to the appropriate joints in Unity by setting the transform.localEulerAngles attributes with the captured euler angles. This works quite well, but I have some Issus like when moving my foot to the right, the avatar in Unity moves its foot to the left.

First I checked, if the capture SDK uses the same euler angle convention like Unity:

The capture SDKs doc says:

"Rotations are all CCW looking down the axis of rotation (in the minus direction) The order of the Euler angles at each node is z, then x, then y so the complete rotation matrix is YXZ."

Unitys doc says:

"The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order)."

So the order of rotation seems to be the same, except I don't really know what is meant by "rotation matrix is YXZ" and if unity also uses counter clockwise rotation like the sdk. Could that be the problem?

I also checked, if the sdk uses the same definition for its coordinate system as unity:

The capture SDKs doc says:

"The actor will be placed standing up along the positive Z axis with the lowest foot at Z=0, facing down the minus Y axis, with the positive X axis pointing to the actor's right. This is a right handed coordinate system."

As a result of these information the sdk coordinate system looks like that:

sdk coordinate system

The avatar is looking in -y direction and the rotation order of the euler angles is z, x, y.

And thats the coordinate System in Unity:

unity coordinate system

The avatar is looking in z direction. The z axis in unity is equivalent to the -y axis of the sdk. The same applies for y, z and x, x. As a result of this I have to use the z values of the sdk for my y values in unity, the negated y values from the sdk for my z values in unity and the x values from the sdk for my x values in unity.

After having done this, I think I have one more problem. Unity will now apply the rotation by first rotating around the z axis (which was originally my -y axis in the sdk), than around the x axis (which was originally my x axis) and finally around the y axis (originally the z axis). This means in unity the original sdk axis are rotated in the following order: -y, x, z. Actually thats not what I want to do, as I want to rotate in z, x, y order.

I would really like to know, if my thoughts on that are correct and if yes, what would be a solution to get back to the right rotation order in Unity?

cordsystemssdk.png (2.1 kB)
cordsystemsunity1.png (2.4 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 emeraldsong · Jul 31, 2016 at 08:43 AM 0
Share

@Averius

I wondered if you solved your problem? I have the same problem on an animation project and it's proving very difficult to make progress. It would be great if you or another user can advise what to bear in $$anonymous$$d when transferring the data to my animation ready rig. I'm working in $$anonymous$$aya.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GeorgeTheCableCar · Oct 04, 2016 at 10:18 AM

Well this may be a year late, but for people who run into the same problem- the solution is to use quaternions to modify the rotation directly.

e.g

 Object.transform.localRotation = 
     Quaternion.AngleAxis(AngleZdeg, Vector3.forward) *
     Quaternion.AngleAxis(AngleYdeg, Vector3.up) * 
     Quaternion.AngleAxis(AngleXdeg, Vector3.right);

This would rotate XYZ in that order. Notice that the order is in reverse. This is because of the way unity overloaded the multiplication operator You just have to do whatever order you want in reverse.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

2D animation : problem with rotation interpolation 1 Answer

Detecting Opposite Rotations of two Pipes 1 Answer

trying to RotateAround an object around another object using mouse 1 Answer

Quad rotor simulation spin between 180/-180 1 Answer

Instantiated object should be rotated by 90 but it is only 0.7 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