1

There are a lot of similar questions, but I can't find the answer =(. I get a quaternion from the sensor in right hand coordinate system. Then I draw an object in the Unity by this quaternion. Unity uses left handed cordinate system. And if I rotate sensor clockwise by one axis, one axis will always rotate in the opposite direction =( I've read a lot of books, articles, forums posts for about 3 weeks. And I still can't find a solution.

I've tested follow algorithms: 1. Convert quaternion to matrix -> then convert matrix to left handed CS ( determinaте will be -1) -> and convert back to quaternion - this doesn't work.

Transformation matrix (3x3) = 1 0 0 0 1 0 0 1 -1

Matrix in new CS = (Transformation matrix)(q_mat)(Transformation matrix)

  1. Flip two component of quaternion also will save right CS. It will flip two axis.

And a lot of other methods.... Please help =(((

1 Answer 1

4

If you want to convert right-handed coordinate to Unity's left handed coordinate, use the function below:

private Quaternion rightCoordToUnityCord(Quaternion q)
{
    return new Quaternion(q.x, q.y, -q.z, -q.w);
}

It came from Unity's doc and I've been using it since I found it. Hopefully it will solve your problem.

Sign up to request clarification or add additional context in comments.

8 Comments

I did it, it' will swop X and Y and save right handed CS
Unfortunately no/ This method change rotation of two axis and now all three axis give rotation in opposite direction.
Are you sure? What's/Where is the input of the right-handed coordinate?
Yes. Without changes only Z axis give opposite direction. After return new Quaternion(q.x, q.y, -q.z, -q.w); All three axis has opposite direction.
Quternion from sensor in the right handed coordinate.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.