How to get static mesh position in Blueprint

I have a blueprint that contains several static mesh components. I need to find the (world) position of the static meshes. The individual meshes are modelled such that they fit together perfectly without manually moving them in UE4, therefore I can’t just get the local offset (it is always 0).

  • I have tried to add Sockets to the
    original meshes, but they are not
    available in the blueprint (querying
    all the sockets returns none at all
    and in details panel, only the parent
    socket shows up).

  • I have tried to get the vertex data.
    I have allowed CPU access on the
    static meshes, but when trying to
    access them via “Get Section from
    Static Mesh”, I don’t get any
    sections at all, and thus also no
    vertex data.

  • I have tried to calculate the bounds
    of the mesh, but that always returns
    0 for both min and max.

I have placed scene components into the blueprint now to help myself, but i’d still like to know an answer to the question, because I need to do this for several BPs that may contain arbitrary amounts of static mesh components.

As I said in my question, the Meshes are modelled such that the fit together withouth any translation in UE4. Therefore the relative location is 0 for all the static meshes

Have you tried simply using GetWorldLocation on the static mesh component itself?

did you try to use the first image?

Yes, but that returns the position of the scene component under which my static meshes are set into the blueprint

Yes, but that returns the position of the scene component under which my static meshes are set into the blueprint, too, because of the way the individual meshes are not model around their own center

Unreal stores all transforms in the origin of the mesh, so if you have modeled your static meshes to “be somewhere else” than the origin, then “getting the world position of the mesh” isn’t a meaningful sentence as it will only return the location of the origin, which isn’t useful to you.

I don’t think there are any simple way to do what you want to achieve without changing the actual meshes so that each of them has an origin in a meaningful location, instead of having every origin at a common zero.

“getting the world position of the mesh” isn’t a meaningful sentence as it will only return the location of the origin, which isn’t useful to you.

I realize that, which is why I tried vertex positions and Sockets. I have seen others work with vertex positions especially, but I don’t see why it works for some static meshes but not in my case. So far as I could find, you have to allow the CPU access to the static meshes, and then you can query them via getting a segment of the mesh. However as I mentioned, my static meshes don’t have any segments (or at least querying the number of segments returns 0), and I don’t know how to fix that.

Idk, as a temporary workaround you can put an additional invisible mesh into your mesh as a child, and get the world location of that. Not the best way though, but might work.

That is kind of what I did, as for now I added scene components into the blueprint where the meshes are.