How to get Location.X, Location.Y or Location.Z from a blueprint component?

I create a actor (like a cube) in my blueprint character, this actor has a initial position. I want to when i press the C key, this cube appreas above my character.

So basically, wen i ress C, this actor must have the same x and y than his parent but his z will be parent.z + 1000 or something.

Thank you for your attention.

Greetings.

Hi,
You can do “get location” on components which returns a Vector3. If you do “break vector” on that location you will see R,G and B, which are the same as X, Y and Z. Each will be a float (aka scalar). You can also make a location vector by assembling floats by using “make vector”. Then you can take pieces from each location and assemble them as you like.

Adding on what RyanB said if you want the parent location just use “Get Owner” and check if it’s a type you’re looking for (in the widest sense just cast it to “Actor” or more specifically like “Character” or directly your player character).

This should provide you with the location of the owner.

However you don’t have to modify that yourself. Components have a relative location. You can just set that to be a few units above and the cube (if it does not simulate physics) will stay at the position relative to the character.

Cheers