Geiger Counter

Hello everyone!
Does anyone know how I can make a Geiger counter needle rotate based on the distance between the player and some “radioactive material”?
Should I use a Line Trace or OnBeginOverlap for this?

I’d also like the needle to have a slight left–right jitter so it’s not completely static — it should still rotate based on distance, but when the value isn’t changing much, it should wobble a bit for realism.

Additionally, how can I make it so that each time the needle updates (for example, every Tick), it plays a clicking sound like a real Geiger counter?

Thanks in advance!

Hey @Mixi1123! Welcome to the forums!

I’m going to kind of skim because this is multiple questions, let me know if there’s anything you’d like a more detailed explanation on!

Have a collider sphere on the “Radioactive_Actor” that goes out to the furthest reaches of where it would affect the player. Then use OnBeginOverlap to start a SetTimerByFunction, with an update speed relatively low, let’s say .075.

The connected function should check distance between the “Radioactive_Actor”'s Actor Location and the PLAYER’s Actor Location
(Use a Vector minus Vector node and then a Vector Length node).

Then you’ll take that distance and do math in a Function- make sure the String on the Set Timer By Function matches the function’s name exactly!

From here, with that number you could do a load of things, it all depends on how YOU want it to behave! :slight_smile: As far as putting a dial on the screen you can use a UI widget of some kind or another (Progress bar type, I believe, but you’d need a custom one I don’t think UE5 comes with one). If you wanted the Geiger counter to be in the environment of the game, that’s something else entirely.

Get back to us with a bit more info! :slight_smile:

1 Like

Hi again, thanks for the welcome!

I got it working with line trace, and yeah that “needle” is in 3D form not UI. One thing i can’t get is sound it plays but it doesn’t stop. Here is the Screenshot, i probably didn’t do something right, but i’m new in Game Development and i have spend so much time on getting this system to “work” :smile:

And i love every thing about Unreal and Epic, You guys really try to make everything simple and help people :smile:

Where are you playing the sound?

Maybe try a check using any of these Floats- if it’s above 0 or whatever threshold, play sound, if it’s below 0, stop sound. But of the ways you could be playing sound, I don’t see any?

I tried after Timeline, but it didn’t worked

Can you show what you mean with a picture? Also, can you show the insides of that timeline?

“Edit: Got The sound working. The fix is just to have Do Once and if there isn’t anything detected just plug that in reset”

Here is inside of Timeline

One thing about it is that the first time it rotates, it does it by Timeline, but next time it just snaps to that rotation, and besides that i would like to make that needle doesn’t stay static, it has left–right jitter