Orient and Quaternion Order

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

  1. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    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. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    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. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    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. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    317
    Yes, I think usually you will see quaternions printed as (x,y,z,w).
  5. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    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.
  6. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Got some weird results with [s,i,j,k], So going with [i,j,k,s]

    Projected coordinate system for a single laser tower:

    x: left of facing
    y: reverse from facing
    z: up

Share This Page