I can't get the world location of a Spring arm from another Blueprint

Hello,

I have a little problem with interaction between two blueprints .
I have a BP_CameraPawn Blueprint, that have a Spring arm and a camera, and he are movable with some keys.

Here is the screenshot of the BP_CameraPawn blueprint

60802-bp_camerapawn.jpg

And I have another blueprint, BP_Test, in which I will get the world location of the spring arm from the BP_CameraPawn blueprint, but it shows me every time (0,0,0) , even when I move the BP_CameraPawn .

Here is the detail of the BP_Test

The same blueprint but in Runtime, with the value of the WorldLocation

Have you a Idea, why the world location don’t updated ?

Thx.

PS : Excuse me for my bad english.

How are you assigning the reference to the other BP with the spring arm? My guess is that somehow that variable is either null or pointing to a separate copy of your pawn BP that spawned in.

If you debug and mouseover that BP ref variable does it mention an object?

Thanks for your answer RyanB.

In the BP_Test Blueprint, I have created a variable with a Type BP_CameraSpawn. This is normaly a basic link with another blueprint, isn’t it ?
I’m not on my Pc yet, but yes I’ve tried to mouseover the blueprint and it doesn’t found the object, it display “None” all the time, but I don’t know why.

,

The issue is, that in BP_Test, you have defined, bp_camerapawn_test, and I think that if you right click on the variable, and then click on “find references” that there is not a “set” for the variable anyplace in BP_test, or if there is, it’s never executed.

The reason is, it’s not sufficient to just have a variable in BP_Test, and expect Bp_CameraPawn to update it, BP_CameraPawn must be called, and then will have to return a value to set bp_camerapawn_test to. Such that it has a value, if this is never done, then bpo_camerapawn_test, will always just have it’s default value, which in this case is 0,0,0

In order to do this, in BP_cameraPawn, create a “public” function ( this is the default for all functions when first created), so that BP_Test can call it. Then in the new function in Bp_camerapawn, define the function to return the world location of the object via it’s return node. In Bp_test, in the event graph, instead of the event tick, being wired to the print string node, you would wire it to the function that you just created in BP_CameraPawn. This would then call that function, and have the return value that you wanted, then you can write that return value to bp_camerapawn_test, and off you go.

The function Call will need, a reference to the blueprint BP_Camerapawn in order to “know” what to call. So define a new variable, of type bp_camerapawn, and wire that into the function call. Hopefully you only have 1 blueprint of BP_camerapawn in the level.

Hope this helps,

You are missing a piece of the puzzle. When you make a variable of a certain class reference type, it is by default an empty container reference until you assign an object to it manually.

For example I will usually do something like “get player pawn” on “Begin Play” and then Cast that player pawn to the specific pawn BP type. Then I store the result inside of some Player_BP type reference variable. Since that is done on behin play, it only happens once and then I can access the player_BP as a direct reference without further casting. It sounds like you just need that step.

If you can place both actors int he level ahead of time (meaning they arent spawned during gameplay), you can manually assign the references by making your variables editable and using the dropper icon on the details panel to associate them with eachother.

Thanks to you both, I have made the function in the BP_CameraPawn and called it in the BP_Test and it’s working perfectly.

Thanks a lot !!

How do you get the spring arm length when it’s being pushed up against something?

I’m looking for the function called “GetSpringArmCurrentLength”?