Solve z-Up exported collada file from blender in OpenGL
Asked Answered
I

1

8

I export models from Blender to Collada with animation. As it is known, Blender is a right-handed system so its up axis is z and OpenGL ES2 is Y-Up.

For static meshes I can rotate the object around x axis for 90° degrees but when I apply the rotation to the frame's matrix, it has unexpected results.

So how can I do this?

Idiotic answered 1/2, 2017 at 14:48 Comment(3)
What exactly do you mean with "frame's matrix"? I merely rotated a mesh with all the bones in object mode by -90° on the x-axis and got the result I would expect (with animations)Formula
Can you give us more detail on what the 'unexpected results' were? Screenshots maybe or at least...what was unexpected?Pyroconductivity
Note that order-of-operations really matters here. You should be applying the rotation before any other transformations happen (i.e., it should come before any translation to world-space, etc.)Pyroconductivity
I
1

To Rotate an Object:

To rotate the object manually, make sure you select the object (normally by right-clicking the object). Then simply press "R" on your keyboard and move the mouse and see the object rotate accordingly. You might realize you have limitation on how it rotates; press "R" again and now you will see the object rotating freely depending on how you move your mouse.

If you want to rotate the object around the x-axis by 90 degrees, then once again select the object, press "R" on your keyboard (R is for Rotate), then press "X" on your keyboard (X is for X-axis), then type in 90 on your numpad, and finally hit "Enter". You will see your object rotate by 90 degree along the X-axis.

To Rotate an Entire Scene:

  1. Select all parent objects
  2. Move 3D cursor to 0,0,0
  3. Rotate around cursor: global X axis, -90 deg
  4. Apply rotation
  5. Continue with the usual export

The correct way to handle this problem is to do the rotation as part of the export since the point of an export would be to take a correctly oriented Blender object and produce a correctly oriented Unity object. You should be performing the rotation before anything else. The application of the rotation should come before any translation in the actual frame.

More detail on this can be found at the following thread: https://blenderartists.org/forum/archive/index.php/t-255246.html

Inchoative answered 11/5, 2017 at 16:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.