Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solve z-Up exported collada file from blender in OpenGL

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?

like image 243
Mohamed Avatar asked Feb 01 '17 14:02

Mohamed


1 Answers

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

like image 159
lax1089 Avatar answered Oct 15 '22 02:10

lax1089