Code a Real Time Analog Wall Clock using C# [Unity 2018 intermediate tutorial]

preview_player
Показать описание
Script an analog real time wall clock with C#. Rotate and animate the hands using the awesome iTween tool.

····················································································

♥ Subscribe to Oxmond Tutorials:

● Download the Clock script here:

● Download free Analog Wall Clock assets here:
Designed by Iconicbestiary

● Download the free iTween tool here:

● Other free Asset Packages at the Unity Assets Store:
(Affiliate links / sponsored by Unity)

Any support is truly appreciated so we can keep on making high quality content.

#Unity3d #UnityTutorial #UnityTutorialIntermediate

😷👕 Need a face mask / developer T-shirt? Drop by our merchandise shop and get a 20% DISCOUNT on your first purchase by using the discount code YOUTUBE. Just follow this link:

····················································································

Try our Bumperball game:

iOS:

Рекомендации по теме
Комментарии
Автор

Many thanks! Perfect pace, clear and easy to follow! 👏👏👏

szabolcscsengoi
Автор

Code -

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Clock : MonoBehaviour
{
public GameObject secondHand;
public GameObject minuteHand;
public GameObject hourHand;
string oldSeconds;
// Update is called once per frame
void Update()
{
string seconds =

if(seconds != oldSeconds)
{
UpdateTimer();
}
oldSeconds = seconds;
}

void UpdateTimer()
{
int secondsInt =
int minutesInt =
int hoursInt =

print(hoursInt + " : " + minutesInt + " : " + secondsInt);

iTween.RotateTo(secondHand, iTween.Hash("z", secondsInt * 6 * -1, "time", 1, "easeType", "easeOutQuint"));
iTween.RotateTo(minuteHand, iTween.Hash("z", minutesInt * 6 * -1, "time", 1, "easeType", "easeOutElastic"));

float hourDistance = (float)(minutesInt)/60f;
iTween.RotateTo(hourHand, iTween.Hash("z", (hoursInt + hourDistance) * 360 / 12 * -1, "time", 1, "easetype", "easeOutQuint"));
}
}

ankitmehrotra
Автор

Thank you Sir! This was extremely useful :)

LCBS
Автор

Great Tutorial mate. Any chance you could show how to code a second hand ticking sound?

residentsicko
Автор

After 12 PM the clock hands rotates 360 degrees to the spot they're supposed to. Does anyone have a fix to this?

Matdrox
Автор

How to rotate by finger touch on mobile?

kayumiy
Автор

this is cool and all, but if i want the full 24 hour clock, how can i do that?

yakanashe
Автор

can you send me the objects of the clock?

MaQuInamortal
Автор

Can you make that with the 1 on top 7 on the bottom 4 East 10 west and make a video on that or you can pass that code. Lol

ivixxmcmlxxxvii
Автор

Hey there, I would like to ask how to assign the iTween tool into the clock? cause my clock is not moving.Thanks

binsonfeng
Автор

everything is fine till you get to third party. Hate using third party assets.

true_warlock
welcome to shbcf.ru