How to script a Clock

I have a model of a clock like device that has 6 disks stacked on top of each other that should rotate and act like a clock. The motion should work like this:

First disk: rotate every second 35 degrees counterclockwise like an actual watch hand, but not with a teleport like transition. The motion should still be visible.
Second disk: every time the first disk made 10 35 degree steps, it should make one 35 degree step.
Third disk: every time the second disk made 10 35 degree steps, it should make one 35 degree step and so on down to the last disk.

The time interval of the first disk should be a variable that can be changed and affect the other disks motion accordingly. Or to put it differently, for every 10 steps one disk makes, the following one below should make one step, just like a counter.

Maybe this sound trivial to code, but maybe someone could show me how that is done properly.

Thank you.

Hi man,
Start with taking a custom actor blueprint, and add your model.
In the tick event you get the “amount of time” that pass between ticks.
Now you just have to put in relation the time with the rotation !
Let me know if you need a step by step

Hi,

I am at the point where I have an actor blueprint that is attached to disk one with which I can let the disk rotate depending on a float value. Its just an continues motion with no steps that could serve as a counter of some sort. This is my first project in scripting and I thought “hey, just some rotating disks, how hard could that be right?” Well, I underestimated the sheer amount of nodes I can string together and I dont know nearly enough of them to even begin to come up with a working model without to first go through the all documentation. I need some kind of starting point from which I can continue to learn.

I thought about it like this: Make blueprint for disk one that only makes the steps and ticks every second to make a 35 degree rotation. Then attach another blueprint to disk two that get the tick count from the blueprint of disk one and reads like “if 10 steps are counted, make one 35 degree step” and then attach the same blueprint to the rest of the disks referring just the one above itself, like a chain. I am sure that there is method with just one blueprint, but that is still far above my head.

Problem is, I have no clue how to do it and the tutorials on YouTube and on the web arent of much help. So if you could explain that process step by step, that would be awesome.

Hi man,
For reference, i have a ■■■■ spaceship in 1 blueprint, so you can build really big and complex stuff with just one blueprint.

This is a simple clock, you can upgrade it using arrays and more complex movement.

So, i start making some disks with a cylindrical component, and adding a cube stretched like this.
I placed the cube as child of the diisk, so when i rotate the disk i can see the “arrow” movement.
I duplicated them.

The whole thing work with just 1 variable float called “ALL CLOCK TIME”
it start from 0 and will increase for every tick , of the time passed. so that will store the time .

I check the time and when it reach a value greater than 1 sec, i remove 1 second from the rimer and go on. (so if time is 1.1234 , will be 0.1234)

I will rotate the Disk 1 of 5 degrees (Sorry i didnt understand completely your concept of 35 degrees)
and then check if this disk has been rotated more than 35 degrees. IF yes, it will reset himself to initial rotation and rotate to the next Disk.

PS:
— This is a draft and i just copied the nodes, and just changed the reference to the Disk02
But this will be bad in future, because if you have 6 disks, you will have 6 copy of nodes and is not pretty clever.
For more advanced blueprint you should learn Arrays
and store all disk you want in one array. so you will have just to have these operation 1 time.
And apply them in loop for all disk you have.
— Another thing you could want to upgrade is the movement of the thing.
i think is pretty visible as this, but you could set this thing to tick smaller degrees like 1, multiple times
Or maybe use timelines to smoothly add the rotation at every tick
or define define different variables to control the rotation of every disk independently from the main blueprint.
so every disk will rotate of 0.05 degrees toward the max variable you set…

So you can do these stuff in endeless ways

■■■■, thats cool, thank you!

The 35 degrees should be 36 degrees because if refers to that the disks have the numbers 1 to 10 on them and so every step divides by 36 degrees until they made a full 360 degree rotation. In that way, you can always see how many steps were counted already up to a million steps, then the positions of all six disks will have reached their starting position again.

I will take your approach and try to implement and tweak it and see if I can get it to run.

Thank you again man.