Location difference between root and static mesh

Hi!

I think I am having a fairly rare problem, in that I would need to figure if there is any way to get the location of the mesh model as it is in level and not the root. Let’s say, I have an object that when its root is placed at Location 0, 0, 0, it’s static mesh is at location 20, 20, 0, hence clearly offset from root. Is there any way I can get a reference to the location of the static mesh (20, 20, 0) and not the root (0, 0, 0) or their difference?

I would need to figure this out as I have models that are imported to UE from external program where their position has to be exact in their alignment to one another, as I have no other way to set their exact location on the level or import data concerning it.

Tips are as always much appreciated!

the simplest method would be to have a reference to the component (your mesh) that your looking to target then use the get world location node.

beyond that there are methods which use math to calculate the location of the component based on the actors location and the relative location but the first method is much simpler.

Hi! Thank you for your response! I tried the first solution but with no luck unfortunately, is refers to same location as the root always. I tried Get Static Mesh Component World Location and Socket Location but they give the same location as the root has.

Also, in the editor it shows they have the same location albeit they are situated in different place on the map.

if the get world location returns the location of the root, then that is the location of the origin of your mesh. it could be that when you exported the mesh from your modeling software the mesh wasnt positioned at 0,0,0 so it ended up being offset from the origin. ue4 doesnt care where the actual geometry of a mesh is for its location, it just uses the origin of the mesh.

so anyway theres only a few solutions if the above is indeed your issue. first you could go back to the modeling software and fix the origin. second you could place a scene component where the geometry is and get thats location, but thats a poor workaround.

also in your picture it makes it look like toilet is the actor and the mesh is the root component. though that cant be right if your explanation is correct.

Hi! Thank you for your continued input on this.

To clarify my project; I am importing a 3D map from Blender that is based on an image from which a 3D model has been converted from. The map has hundreds of different objects, thus it is not viable for me manually add an object on top of them all in the UE project as this would take way too much time.

I am trying to make this faster by replacing the models of the map with a new mesh in UE. This does not work due to issue described; the mesh always being placed to coordinates 0, 0, 0. Thus UE is not able to differentiate the root location (always 0, 0, 0) from the actual mesh location which is what I am trying to achieve somehow.

Furthermore; I will try to do what was achieved here: Origin point of meshes - Content Creation - Unreal Engine Forums

Automate mesh addition via blueprint add scene component.

Hi,
Unfortunately adding scene compoment did not work; it still adds the mesh always to to 0, 0, 0, even if scene compoment is added. I would have to manually add the component to the location of the mesh, which is not a viable method as I have hundreds of objects.

Edit: Possible solution found: Enable ‘Bake Pivot in Vertex’ during import.

Possible solution found: Enable ‘Bake Pivot in Vertex’ during import.