How to get a distance variable to refresh each frame?

Hi! I’m very new to UE4, but well-versed in data-flow-scripting. I’m trying to make a field of dynamic tiles that light up when you get near them, kind of like this unity tutorial here: UNITY 03 PREFAB BEHAVIORS on Vimeo (watch around the 15:00 mark)

So I actually got it working, but it fails to refresh the distance between the player and the tile. If I put in random floats, it does refresh. The distance mapping onto the brightness of the diffuse material works, but only for the first frame.
The way I see it, the data flows above, where i SET the Dist variable I made, but it doesn’t flow and refresh every frame where i need to GET it, in order to drive the brightness.
Help? Thank you

Here’s how it looks when i play it. It works for the first frame, then if i move around it doesn’t change.

Fixed it. The error was somewhere else. Instead of player controller, i was supposed to put in player pawn. The controller only addresses the spawn point for begin play. I figured it out by putting a delay before getting the distance, to allow me to move away from the spawn point - the result was unchanged, so in effect, it hit me that i was referencing that point and not the actual player location. There still is a bit of an odd behaviour with it, as it seems to brighten up the tiles in front of the player and not all around it. No idea why.

I was working on this same thing for over 4 hours. I can’t believe it doesn’t update the distance output every frame if you use a player controller instead of a player pawn. It seems a bit illogical considering most Blueprint nodes want the player controller as an input. After reading your answer, it worked right away. Thanks!

1 Like