3
votes

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."

Since Unitys coordinate system up facing axis is Y and X is facing to the right, I just switched the y and z coordinates when setting the transform.localEulerAngles attributes. I know that Unitys coordinate system is left handed. Do I also have to put this into consideration? Could that be part of my problem?

EDIT:

I've now spent a litte bit more time on thinking about that problem and made some graphics to get a better understanding. The coordinate system that the SDK uses 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?

1

1 Answers

1
votes

Well, if I'm reading it correctly it seems that they aren't the same, and one is a righthanded matrix and the other a lefthanded matrix. Can't you just plot them differently? Switch the z and y values? See if that helps?