make a single hand clock using widget?

i’ll try to explain this the best i can, i want to make a clock that i can set the time later for a day night system but i also want the hours, min and seconds all to be one clock hand, essentially i have this wheel

image
and i’d want it to rotate slowly it doesnt have to be 100% accurate, and lastly i’d like 24 hours to last 24 minutes instead, i’d love help on the coding side of this, i know how to rotate it but not how to figure out the math

Hey @Leafies121!

So we’re going to use delta time here to get your seconds.

Hope this helps! This is the math part, anyway.

awesome so would i have to set the time of day in seconds if i for instance wanted the game to start at noon or a level to start at 10pm?

also i assume this is how i’d implement it

Right. So we’re looking at a 24-hour clock. So to get 10pm you would do
12+10=22,
22*60=1320,
1320/1440=.916667
.916667x360=330

Set Time Of Day = 330
Set Clock Rotation = Time of Day

Looks good!

hey sorry , i attempted to set the time in the event contstruct and it seems to snap back to the original position right after and doesnt move, (didnt move before either)

No worries! Let’s make sure I didn’t mess up the code :stuck_out_tongue:

Try adding these to the end to make sure the value is going up consistently
image

Edit: I did mess it up! I forgot to add to the current time

haha okay so how do we do that then i dont wanna break it

I believe this is the solution, at least to the math. I wasn’t going to sit here for 24 minutes but I think you get the gist enough to fiddle with it if you need to. The functionality is correct, at least! :sweat_smile: Sorry about that!

image

Note that the amount to add dropped two decimal places. That was needed, make sure to do that!

Edit: Now that we know the math, it can be simplified :stuck_out_tongue:
image

1 Like

you are awsome! its working! i am so happy to see this working

1 Like

Of course @Leafies121!

And remember, if you’re ever stuck or looking for a way to go about a task in UE5 we’re here! This is a community! :slight_smile:

1 Like