Answers for "How to make a progress bar increase as it gets closer to an object?"
https://answers.unrealengine.com/questions/847197/how-to-make-a-progress-bar-increase-as-it-gets-clo.html
The latest answers for the question "How to make a progress bar increase as it gets closer to an object?"Answer by ThompsonN13
https://answers.unrealengine.com/answers/847775/view.html
the trouble is that you would need to find the closest point of the boundary then calculate the distance to that point on a very regular basis which could cause a performance loss. depending on your situation you may want to look into just using something like a collision volume to tell the player they are going out of bounds, a hollow blocking volume, or just calculate the distance from the center of the level. the last option mentioned is very easy, you just get max distance from center and player location then normalize to range which will return a 0-1 value.
if you choose to pursue your current method though below is a example of the logic needed. basically you need to have an array of points which represent the boundary of the level, then you need to find if there was a line between each point where on the line am i closest to. thats basically the entire top half of the script, for line from point 0-1 how far is the player from the line, is that closer than the current closest line value, if yes set this line to the closest, repeat for line points 1-2, etc.
now this would all work well for a circle where all points are equal from the center, but in the case of square or irregular shape we need to provide a max range value so we have something to normalize to since a progress bar requires a 0-1 value.
![alt text][1]
[1]: /storage/temp/259709-capture.pngSat, 17 Nov 2018 18:43:45 GMTThompsonN13Answer by mightyenigma
https://answers.unrealengine.com/answers/847211/view.html
Progress bars can be bound to a function or variable that returns a percentage, a float between 0.0 (for 0%) and 1.0 (for 100%).
So you can find the nearest location on the wall (how you do that will be the trick to figure out), use the Distance node on that and the Player Pawn's current Location, clamp that number to a value between 0 and 100,000, and then divide THAT number by 100,000 and you'll have your percent float between 0.0 and 1,0 which will shrink the progress bar down until you hit the wall.
Instead of 100,000 you can use a variable default value of whatever you want the maximum distance the bar cares about to be, beyond which it will just cap out at 100%
So to figure out where the nearest point on the wall is, I'm not sure but there are lots of ways to figure it out and maybe even a blueprint node that lets you do it and for instance if you have 4 such walls boxing in the large area, you could run it 4 times and just keep the smallest value for the distance.Thu, 15 Nov 2018 19:33:19 GMTmightyenigma