Search code examples
unity-game-enginegraphicsgame-physicsnvidiablender

How to make Nvidia FleX rotate the objects the same way as Blender, Unity or other 3D software?


I rotate some objects in FleX, export them and render them in Blender. I realized that the rotations I apply to the objects in FleX does not rotate the objects in the same way that Blender does. If I'm getting it right, I learned that FleX uses a transform matrix to rotate the objects but Blender does not [necessarily] do that. I also talked with someone who is using the FleX plugin in Unity and he said he has the faces similar issues. This is the case for both Euler angles or Quaternions. Below is the piece of code that I use to rotate the objects in FleX. I'm pretty new to FleX and I don't know which functions I should use so that I can get the same rotations as I get in Blender, without unnecessary transformations. Can someone help me with this?

For rotation with Euler angles:

obj->Transform(RotationMatrix(rx, Vec3(1.0f, 0.0f, 0.0f)));
obj->Transform(RotationMatrix(ry, Vec3(0.0f, 1.0f, 0.0f)));
obj->Transform(RotationMatrix(rz, Vec3(0.0f, 0.0f, 1.0f)));

For rotation with Quaternions:

obj->Transform(RotationMatrix(Quat(qx, qy, qz, qw)));

Solution

  • This happens due to different interpretation for the axes in Blender and Flex. [x, y, z] in Blender is interpreted as [-y, z, x] in Nvidia FleX.