Rotation doesn't work in OBJExport

Hi there,
Good morning/afternoon/evening :sweat_smile:
I’m trying to export my meshes into an OBJ file.
https://www.babylonjs-playground.com/#MCJYB5#16


The meshes look good in the canvas, but the rotation doesn’t work anymore.

Any idea? :thinking:


Then I imported it to Rhino, the two meshes are listed vertically… :thinking:

Your obj must express rotation in Quaternion. I you this into the pg

console.log('quaternion- ' + polygon.rotationQuaternion);

result is:
quaternion- {X: -0.7071067811865476 Y:0 Z:0 W:0.7071067811865476}

rotation property is ignored when Quaternion being used. Use must set it to null to get euler rotation to work.

Hi, thank you for your reply.
I’m confused. How can I rotate my mesh without changing the quaternion?
I only used “rotate(BABYLON.Axis.X, -Math.PI/2, BABYLON.Space.WORLD);” :thinking:
Why this changed the quaternion? :thinking:

:joy: I figured out how to avoid using quaternion.
But it still doesn’ work :sweat:
https://www.babylonjs-playground.com/#MCJYB5#17

No rotation in sandbox…

I just starting ripping stuff out. Just set rotation. Why bother with whatever that rotate() does or its side effect of using roatationQuaternion, if you just going to do everything in world space anyway?

this works, https://www.babylonjs-playground.com/#MCJYB5#18.

Hi,
Because my application has many sliders to rotate the mesh and some of them are in local space😭
So I have to use rotate…

Does it work if you bake the transformation before exporting? https://www.babylonjs-playground.com/#MCJYB5#19

2 Likes

It works! Thank you so much! :laughing: