1

I'm working on a custom blender to unity exporter/importer(school project), and I have a bigger problem: The Rotation.

I can get the Euler rotations and/or quaternions from blender, but when I want them to apply in one of Unity's objects, it just totally messes up the rotation.

I've already tried to swap Y and Z coordinates, but it doesn't seems to work either.

I tried but applying a rotation matrix isn't possible in unity... but if somehow we can figure it out, maybe that would be the solution?

I need to find a universal solution as soon as possible. Thanks.

... for a further description, please read the comments bellow.

Z4urce
  • 438
  • 4
  • 14
  • Isn't there some sort of matrix function like "mat.to_4x4"? – Benjamin Danger Johnson May 16 '13 at 16:11
  • Also you should try to take it one angle at a time just to see if swapping is need. I'm pretty sure that the Y and Z axis are swapped in blender (making Z up and Y forward). – Benjamin Danger Johnson May 16 '13 at 16:12
  • I found a function, what converts 3x3 matrix to 4x4 ... now i'm going to try it. I think blender's angle calculation sequence is different from Unity's... that's the source of my problem. – Z4urce May 16 '13 at 17:09
  • Can't apply matrices to Unity... – Z4urce May 16 '13 at 18:39
  • The Main concept: "Export a scene from blender filled with group instances to Unity3D" – Z4urce May 17 '13 at 00:03
  • I know there is a `Make Duplicates Real` function in the Blender's menu, but unfortunately now it isn't an option... (later I will explain why if you're interested) So I decided to write an exporter myself, which one exports from the BGE. It will cycle through the scene objects with `for own in scene.objects:` (Object instances enables you to use the same object multiple time) so I wrote out to an XML file all object's POS, Scale, an ID which generated during the iteration and the Rotation(quaternion and euler) – Z4urce May 17 '13 at 00:20
  • ...The other part of my work was to import this file to Unity. I wanted to import Instances(Prefabs) not meshes... so I imported ONE of all group instances from blender to unity: the original. Now here comes the trick: my Unity importer script will iterate the opened XML list, reads out each objects data, and makes a copy from the equivalent predefined object and places it there where it belongs according to that list... so it will be multiple time copied in the scene, exactli there as the object instance in blender was. ... the problem is: i can't apply the rotation. – Z4urce May 17 '13 at 00:21

0 Answers0