# Orient and Quaternion Order

Discussion in 'Mod Support' started by wondible, September 24, 2015.

1. ### wondiblePost Master General

Messages:
3,303
2,089
Where orient/orientation appears, it's a 4-element array, which I assume is a quaternion. Seems like fixupBuildLocations usually returns one with the third element set to 0. Many references use [s, i, j, k], but I found a DirectX discussion which used [x, y, z, w], which I presume allows passing the quaternion to functions that take a V3. My 3D math is too rusty to come with an easy test for which system is in use.
2. ### crizmessWell-Known Member

Messages:
434
317
Hard to say.
As far as I can remember, all components can report as 0.0 depending on the rotation.
The components x,y,z are representing the vector around the rotation is happening. For example if you have a rotation around a vector (x,y,z) = (1,0,0) you will see something like (x,y,z,w) = (sin(phi/2),0,0,cos(phi/2)).
And quaternion representing no rotation is (x,y,z,w) = (0.0,0,1) where this is the normalized form with sqrt(x² + y² + z² + w²) = 1.
3. ### wondiblePost Master General

Messages:
3,303
2,089
I did discover the identity quaternion, which enabled me to test multiplication under the two forms. I've had some success with the [i, j, k, s] (or [x,y,z,w]) form.
4. ### crizmessWell-Known Member

Messages:
434
317
Yes, I think usually you will see quaternions printed as (x,y,z,w).
5. ### wondiblePost Master General

Messages:
3,303
2,089
Well, found an error in my code and the identity works both ways now. I seem to be getting somewhat usable results from both, although the coordinate systems are different.

Messages:
3,303