Imported 3D OBJ has position and localPosition 0,0,0

i’m importing .Obj and Mtl by script or even by Drag and drop and all the elements inside it are positioned at 0,0,0 but they are placed correctly how can i get correct positioning of the elements ?

This is the following Image(all elements inside the Object are at 0,0,0)

Thank you in advance!

how can i get correct positioning of the elements ?

It’s not really clear what you mean by that. A mesh / mesh part could be positioned anywhere inside it’s local space. So if your “house” consists of several objects, all those objects could use the same local space, so they are all positioned at the same point and all the vertices the parts are composed of are just relative to that. If you want to pivot / origin of the parts to be somewhere else, this has to be done in the modelling software. Unity is not a modelling software.

As a workaround you can put each part into an empty gameobject which you can position at the point where you want the pivot to be and then make the actual piece a child of that. That way you can use that new empty gameobject as the new representation of that piece.

However if it’s important to have the pivots at certain points, you have to do that in a modelling software.

I highly recommend you check the settings at the top of your Unity window and set the pivot mode of the editor handles to pivot (not center) and the coordinate space to local (not global)

This way you see where the object really has its pivot. The other modes are just for convenience when it comes to placement in the editor. Though they can mislead you about the actual pivot. As I said, the pivot can not be changed in the Unity editor unless you wrap it in another gameobject. The pivot isn’t even a “thing”. You can define a rectangle with 4 vertices and have them positioned at:

(100f, 0f, 0f)
(100f, 1f, 0f)
(101f, 1f, 0f)
(100f, 1f, 0f)

This is a 1x1 rectangle, however it is offset by 100 on the x axis. So it’s pivot will be way outside the actual rectangle. That’s just how we have defined the vertices here. We can also defined it like this:

(-0.5f, -0.5f, 0f)
(-0.5f,  0.5f, 0f)
( 0.5f,  0.5f, 0f)
( 0.5f, -0.5f, 0f)

This is still a 1x1 rectangle, but this time the pivot is in the center. Again, this is an intrinsic property of how the mesh has been defined. Moving the pivot means you actually have to shift all the vertices by the same amount. In the case of our rectangle, we moved all vertices by (-100.5f, -0.5f, 0f).

Mote modelling tools allow you to do this by just dragging the “pivot” around. I’m not an artist, so don’t ask me how to do thing in program X or Y, just google it and I’m sure you find a video explaining it for your favourite modelling tool.

Test basic code:

yourObject.transform.position

This code will return a Vector3.