Origin of the model changes when imported in to Godot project

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gdt_dvlpr

Hello,

I have drawn a model made of 3 pieces in blender. These three pieces make up a simple cannon, namely: base (stationary), bearing (for rotating the guns to left or right) and pitch (to raise up or lower the barrel). Origin of first two pieces for my case are not relevant to this question but for completeness they are both at Vector3(0,0,0). The last piece (pitch or barrel as I called it) is somewhat elevated and sitting on top of the bearing piece. In blender it is origin is properly set. (See pic 1) However when I import it to Godot, origin of the last piece is changed to Vector3(0, 0, 0). (See pic 2). Having the origin there causes the pitching of the barrel look awkward.3

What am I doing wrong ?

Please see pictures.

PS: I search the net before posting this question… I have tried what was suggested here (Reddit - Dive into anything) but it didn’t help me.

Thank you

UPDATE
I solved the problem by showing the ear from the other way around. I’d like to think that there must be an easier solution to this silly problem. If an expert provide an insight I would be grateful.

Here is my silly solution:

  1. I separated the barrel from the rest of the model. Created a new file and put just barrel inside in new Blender file (Simple copy paste does it)

  2. This was not enough. I need to move barrel down to match its origin with world’s origin (imagine Vector3(0, 0, 0) ). Save and export as GITF2.0 (Please see picture: 4)

  3. Imported the barrel into Godot. And observed that origin is finally fixed. However I need to move the barrel in the precise location on top of the bearing part in Godot. (please see picture 5)

For this silly little exercise of mine it is not a big issue, however for more complicated models this could raise a flag.

:bust_in_silhouette: Reply From: Inces

Do You remember to Apply all transforms in blender ?
Also You need to ensure, that no modifer influences transform of the model when exporting

Thank you. This could be it. When I applied all transforms, origin of the barrel goes to (0, 0, 0) position. I need to figure out why it is happening. Thanks so much.

gdt_dvlpr | 2023-07-01 18:29

This is just how Blender works. Any transforms occur in local coordinates, and if You want the position to be global, which is origin independent - You just need to apply these transforms. When working in blender You just have to incorporate some things into your workflow, to always do some procedures before exporting models.
Most important ones are applying transforms and modifiers, unwrapping UV, pushing animations into NLA editor, tiding mesh geometry and ensuring normals point out.

Inces | 2023-07-01 19:58

Thanks so much. I am not just new to Godot and game programming, I am also new to the Blender as well. Trying to figure out my way around all those :slight_smile:

I definitely didn’t know that I had to apply those transformations before hand.

I tried what you suggested and it fixed the origin problem. Thanks again for your time. I do appreciate it.

gdt_dvlpr | 2023-07-01 21:38