I am developing a submarine game and am looking to create a bar with an arrow beside it that gives you an idea of how far from the bottom of the ocean you are. Basically the bar will have an arrow on the side of it indicating the players current position in relation to the ground. As they get closer to the ground the arrow will get closer to the bottom of the bar etc. The vision I have is pretty much the same as PUBG does with the gauge shown when parachuting (see attached image).
for the script part of this i would start by looking into the get vertical distance to node. that should be an easy way to get the distance between two objects. or if you wanted to be more precise you would need to use a bit of math and a line trace. its actually fairly simple line trace from player to so many units in the -Z direction then take the players location and subtract the hit location.
@ThompsonN13 Thanks for the reply! I took your advice and implemented a line trace. I now get an accurate distance between the sub and the ground. My next question is, how would I put this into use with a visual representation like the attachment on the original question?
you have the numerical value so making text counter would be easy. if you want a more visual thing like the bar you showed then you would need to create a widget with a progress bar. since progress bars work by showing a value between one and zero you will need to normalize your distance. you can do this by using the normalize to range node. with this method you will need a set value for the top end of the range.
@ThompsonN13 One more thing I am having an issue with when trying to get this to work with my current situation. The progress bar is working perfectly, filling more and more as I get closer to the ground. But how could I get the arrow beside the bar to follow the filling?
im not exactly sure on that one since i dont do a heck of alot with widgets but do remember seeing something about moving images on widgets which i think was in this tutorial. not sure if itll help or not. good luck though