How to reflect the "offset or displacement" from center in own exporting-script?

Hi All,

I am writing my own export-/import-script for Blender. At the moment I am focousing on the export-function and export in the .obj-format to learn the basics. At the end I will be changing it to a JSON-format.

What works at the moment is to write vertices (using mesh.vertices) and faces (using mesh.polygons) related to an object. The challenge I am facing is now that it seems like mesh.vertices is not providing the real coordinates but coordinates which are related to themselves, i.e. the object is saved with the proper details but if I load it, its center will be moved to the origin of my workbench.

I guess there is another function / variable available which I can use to adjust the coordinates provided via mesh.vertices with some kind of an offset or displacement, so the real coordinates are saved.

Can anyone point me towards the right direction?

Thanks a lot in advance!

I have found another parameter which is attached to the objects called “location”. It seems like I can access the object’s location by reading the values of location.x, location.y and location.z. If I add the outcome to the coordinates of my vertices this should do the trick.