Skip to content

Jordan #4

@Eb171767

Description

@Eb171767

using UnityEngine;
using System;

public class Clock : MonoBehaviour
{
public Transform hourHand;
public Transform minuteHand;
public Transform secondHand;

void Update()
{
    DateTime time = DateTime.Now;

    float hourRotation = (time.Hour % 12) / 12f * 360f;
    float minuteRotation = time.Minute / 60f * 360f;
    float secondRotation = time.Second / 60f * 360f;

    hourHand.localRotation = Quaternion.Euler(0, 0, -hourRotation);
    minuteHand.localRotation = Quaternion.Euler(0, 0, -minuteRotation);
    secondHand.localRotation = Quaternion.Euler(0, 0, -secondRotation);
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions