# Quaternion handedness

This topic is 4908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have an interesting problem for you all. I'm trying to load md5 files, but they have a left handed coordinate system. At least they have y and z swapped, I've never been very clear on handedness. Now for the most part this is no problem, I can just swap y and z of all the vectors on load. Where I got stumped is that the quaternions are also affected by handedness. So what I need is some way of swapping y and z for a quaternion. Obviously just swapping the y and z components won't work. What I did try was this:
Quaternion original; //Got from file.
Float3 end = original.Rotate(Float3(1, 0, 0)); //Rotate a vector on the x axis with it.
swap = end.y; //Swap the vectors y and z.
end.y = end.z;
end.z = swap;
Quaternion swapped = QuatDifference(Float3(1, 0, 0), end); //Create quaternion from difference between vector and x axis.


Now that almost worked. Not quite though, it's still a bit off. Anyone know how to do it properly? I'd really appreciate any help, I don't even know what to google.

##### Share on other sites
Quote:
 Original post by RAZORUNREALSo what I need is some way of swapping y and z for a quaternion. Obviously just swapping the y and z components won't work.

It should have worked.
I did exactly that in my MDX-models loader, and it went just fine. Only that I had xyz->zxy swap, so it was still the same handedness. As you have the opposite, you need to explicitly negate all angles (w coord) in the quaternions.

As I like to have w nonnegative, I'd prefer negating the axis (xyz coords).

Cheers.
/def

##### Share on other sites
Thanks, it worked! I'd tried it before, but I didn't negate w, which makes quite a difference.

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×