How to get world transform of meshes exported from Blender?

Exporting a scene from Blender with different meshes, I’m trying to get the actual position, rotation and scale of each mesh from the world origin.

In the Blender scene, I import a mesh from a .glb file. Then I duplicate it, and I move, rotate and scale the duplicated one. I apply all transforms to both meshes to let Babylon add-on export the scene.

Then when I import that scene into Babylon, both meshes are in the 0,0,0 position, 0,0,0 rotation and 1,1,1 scale.

How can I export a scene from Blender to get the actual transform of each mesh from the world origin?

You may find the mesh position with mesh.absolutePosition.
As well as absolutePosition and absoluteScaling - Babylon.js docs

So position rotation and scaling are the local transforms, they wil be usually at origin, and I should work with absolutes?

I’ve just checked and absolute position is also 0,0,0.

For what I’ve reading in this post, I can use mesh.getBoundingInfo().boundingBox.centerWorld to get the actual position, but this is not desired.

The good path would be getting actual position directly from Blender export data.

I don’t get why I have the mesh in this position in Blender, with the origin set to the geometry:

And in Babylon is appears under the floor:

I’m clearly missing something.

Are you using gltf or babylon format to export?

I’m using Babylon exporter 3.3.2

Is it right to export an entire scene using the Blender glTF native exporter?

If you don’t have things which are not supported by GLTF format, it is completely OK.

1 Like

What kind of things are not supported?

Lights, cameras, animations, materials, shaders…?

Lights, cameras, animations, materials, shaders: all of that is supported :slight_smile:

1 Like

For example, partcle systems are not supported in GLTF format.

That’s not a problem, the game engine will generate them. I will go for .glb files.

Thanks!

1 Like