Hi guys, How can i make a gas detector?

I am making a gas detector and facing a simple but big problem now…just wanna know how to make a usable gas detector, so far i have done left click to turn on, right click to activate gas detector so i can detect gas. the problem is how to make a floating number that when i close to centre, the number can increase.

my idea is when i hold right click - number appears - when i move like 1M to centre - number add 0.1.

so far i make a UMG so my number can appear on it.
I know it is ez one…but somehow i cannot get it…
i am new to ue4, cannot fully make this without any help. tried youtube…nothing…
sry about my eng.

gas clouds are a real tricky thing to pull off, so unless your just trying to make a super simple one you may run into more issues down the line.

a basic way to do it though would be to have a volume (say a sphere volume), then get its extent and its origin then you could normalize the difference to get a 0 to 1 value kind of a psudo percent. this way you could easily determine how close you are to the center.

and just for fun i made a little detector script of my own. this version was made in the level bp (coulb be made in any bp) and takes into account overlapping gas cloud actors. it updates every 0.25 seconds and can combine the values of multiple clouds. it will even go over the limit of 1 if you wanted to.

i should also note that i was using a print string on tick to report the values. if you wanted to do that in a widget then you would just need to report the values to the widget or create a binding that holds the value.

reallllly appreciate mate, thank you so much. somehow it oddly does not work on my side…and later i used line trace by channel, but i cannot make it work as well…sad…i am new to UE4…have to keep trying…i will use yours again to see where is wrong…by far urs looks reasonable…

what doesnt work? what did you do / try? can you explain what does or doesnt happen? that way i can try to point you in the right direction.

the one i made just takes a volume and tells you how close you are to the center by giving you a 0-1 number. this could be thought of as a density of gas if you wanted. it would work well for pockets of gas but its use is situation dependent. for example if you had a cloud with an irregular shape then it may not be the best.