Hi everyone,
as a newbie I’m trying to study and modify this Unity tutorial, and more in depth the very last section, where clock is improved by an analog movement:
void Update () {
if (analog) {
TimeSpan timespan = DateTime.Now.TimeOfDay;
hours.localRotation =
Quaternion.Euler(0f,0f,(float)timespan.TotalHours * -hoursToDegrees);
minutes.localRotation =
Quaternion.Euler(0f,0f,(float)timespan.TotalMinutes * -minutesToDegrees);
seconds.localRotation =
Quaternion.Euler(0f,0f,(float)timespan.TotalSeconds * -secondsToDegrees);
}
[etc]
I would like to start the analog movement from a custom time, like for example 00:00:30 secs. If it was easy with the part that produces discrete steps, here I’m stuck despite several attempts, and still much more confused.
If I declare something like this for example:
TimeSpan timespan = new TimeSpan(0, 0, 0, 30, 0);
and during the Update() I put
timespan =+ timespan.Add(new TimeSpan(0, 0, 1));
seconds arm act speed is very fast, like if it’s working like millisecond. Minute arms, in fact, works like a seconds arm, and so on. I think it’s due to Update() timing, but is there a way solve this with another approach?
Any help will be very appreciated,
thanks in advance.