|
![](/i/fill.gif) |
I'm trying to export data from Blender.
If you have ever used Blender you will see that the Y axis is pointing
forward and the Z axis is pointing up.
My problem is that I need to flip everything so that the Y axis is up
and the Z axis is forward, so basically swapping the two.
For vectors it's easy, just swap y and z :
[x, y, z] becomes [x, z, y]
and after a lot of searching on the internet I even how to flip a matrix:
{ rx, ry, rz, 0 }
{ ux, uy, uz, 0 }
{ lx, ly, lz, 0 }
{ px, py, pz, 1 }
becomes
{ rx, rz, ry, 0 }
{ lx, lz, ly, 0 }
{ ux, uz, uy, 0 }
{ px, pz, py, 1 }
Both of these seem to work but I can't find how to flip a quaternion.
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
c schrieb:
> I'm trying to export data from Blender.
> If you have ever used Blender you will see that the Y axis is pointing
> forward and the Z axis is pointing up.
>
> My problem is that I need to flip everything so that the Y axis is up
> and the Z axis is forward, so basically swapping the two.
If all else fails, you can always use a rotate about the X axis by 90
degrees, followed by a scale by <1,-1,1> to flip direction of the
then-up Y axis.
Or just export the whole scene to use a fitting coordinate model, by
defining appropriate up/right/direction and sky vectors in the camera
statement.
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
> Both of these seem to work but I can't find how to flip a quaternion.
A rotation quaternion is defined as (w,x,y,z) where xyz is the axis to
rotate around and w is related to the rotation angle. Would simply swapping
the y and z elements around do what you want?
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
scott wrote:
>> Both of these seem to work but I can't find how to flip a quaternion.
>
> A rotation quaternion is defined as (w,x,y,z) where xyz is the axis to
> rotate around and w is related to the rotation angle. Would simply
> swapping the y and z elements around do what you want?
>
>
Now I've resorted to leaving the coordinates the same and just flipping
the camera around instead,
and I've got everything working like that, but now I'm having problems
flipping a matrix.
So for now I'm just going to leave it like it is and maybe come back to
that later.
Post a reply to this message
|
![](/i/fill.gif) |