CatLikeCoding Basic No.1
using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class clock : MonoBehaviour { const float hoursToDegrees = -30f, MinToDegrees = -6f, SecToDegrees = -6f; [SerializeField] Transform hourPivot, minutesPivot, secondsPivot; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { TimeSpan time = DateTime.Now.TimeOfDay; hourPivot.localRotation = Quaternion.Euler(0f, 0f, hoursToDegrees * (float)time.TotalHours); minutesPivot.localRotation = Quaternion.Euler(0f, 0f, MinToDegrees * (float)time.TotalMinutes); secondsPivot.localRotation = Quaternion.Euler(0f, 0f, SecToDegrees * (float)time.TotalSeconds); } }