playMaker

Author Topic: Clock  (Read 1411 times)

westray

  • Playmaker Newbie
  • *
  • Posts: 2
Clock
« on: June 20, 2016, 01:50:26 PM »
I am following a C# tutorial and trying to do it using Playmaker but without much success.Can anyony help.
Here is the C# code
 
 using UnityEngine;
using System;

public class ClockAnimator : MonoBehaviour {

    private const float
        hoursToDegrees = 360f / 12f,
        minutesToDegrees = 360f / 60f,
        secondsToDegrees = 360f / 60f;

    public Transform hours, minutes, seconds;

    void Update () {
        DateTime time = DateTime.Now;
        hours.localRotation = Quaternion.Euler(0f, 0f, time.Hour * -hoursToDegrees);
        minutes.localRotation = Quaternion.Euler(0f, 0f, time.Minute * -minutesToDegrees);
        seconds.localRotation = Quaternion.Euler(0f, 0f, time.Second * -secondsToDegrees);
    }
}


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Clock
« Reply #1 on: June 20, 2016, 05:34:09 PM »
hi,
To get the "time value" set these in 1 state and then you can do the calculations on it. and maybe use "convert string to float" instead of "convert string to int"