[Solved] Getting blueprint's component's position at run-time?

UPDATE (Jul 7, 2015): Further testing showed that it was the mesh(es) causing the problem. Get World Location would return not the component’s position but the root’s center. It was probably imported into UE improperly.

The code below will work on an actor made from separate meshes.

Heya, people of Unreal Engine 4 AnswerHub!

I’ve gotten into a bit of trouble while working with level blueprints. I have a blueprint that has a number of static meshes combined into a complex item. I instantiate this blueprint in my level, creating an object. I then rotate this object in the level blueprint.

My question is as follows: how do I get each component’s position in space every tick? Is it at all possible? My first attempt returned very odd results.

This is the blueprint I instantiate. It is made up of a number of movable Static Meshes. It has one root component (cross), and the rest of meshes are subcomponents. I made a function, that returns the location of one of the subcomponents.

As soon as the game starts up, the object begins rotating, and every tick this function is called to get the updated location. However, it returns the same value regardless (the one seen on the screenshot). In other words, it seems that getting a component’s location this way (via a getter function) is impossible in this instance?

Maybe I’m approaching this from the wrong end? Any ideas?

Hi. Could you return the location directly WITHOUT setting the vector to a variable and then return the variable’s value?

Yes! That fixed it. Wow, such an interesting quirk, I would’ve spent days trying to figure this out. Thanks!

You are welcome :smiley: