Realtime Clock? (needles)

Hello guys, i’ve got a clock with a needle for seconds and a needle for minutes, is there a predefined javascript function so i can have the right rotations?

i’m talking about a racing clock so it’s not like tic-tac it needs to be a fluent rotation of the needle.

Any help is appreciated

thanks in advance


There is no predefined function for this.
This is very simple mathematics and you will just need to apply linear interpolation to the needles rotation based on fixed time step.
For example there are 60 seconds in a minute so:

360/60 = 6 degrees of rotation persecond.

And minutes:

360/ (60*60) = 0.1 degrees of rotation persecond.

Using these measurements you can then use linear interpolation between the two positions.

Alternatively you can use the fixed update function. This is called a fixed number of times per second and can be adjusted in the edit->project setting → time menu. That way you do not need to use linear interpolation as you know how far the needle will have to move every fixedupdate call.
(see below)

Finally please stop bumping your questions every 20 minutes there is no need to do that as everyone can see the unanswered questions.