1

I managed to get rotations on the console in blender, but when I try to apply it in Unity, it is just very wrong. I am using Quaternion.Set to set the desired rotation. I know that blender uses (WXYZ) quaternion, but when I got these values and set properly it in to Unity3D (XYZW), it gives me nonsense rotations.

http://pastebin.com/bKzUVCih here is the link to my script. Please help me point out what is wrong there.

P.S.: Euler rotations are not an option, because they're lossy as far as I know...

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Citrus
  • 1,162
  • 1
  • 16
  • 38

1 Answers1

2

I have solved this problem to my satisfaction. The problem is that the XYZ rotations of Unity are different from those of Blender. If you wish to convert positioning and rotation of an object perfectly from Blender to Unity, use the following steps:

  1. Rotate the object -90 degrees on the X axis.
  2. Calculate the Blender quaternion. Remember that the Blender quaternion is going to come out in a WXYZ matrix, and a Unity quaternion is going to use a XYZW order.
  3. Rotate your object back 90 degrees on the X axis, export to FBX using the experimental, "apply transform," check box.
  4. Translate your object in Unity using the translation in Blender, BUT use the equivalent of (-X, Z, -Y) for your translation.

If you're looking for a Python script to get the quaternion out of Blender, I've put together one and put most of it here

I might as well put a YouTube clip together on this, it's simplistic but ridiculously hard to figure out.

Dylan Brams
  • 2,089
  • 1
  • 19
  • 36