- Home /
Question by
gokulreddy · Apr 24, 2015 at 06:00 PM ·
rotate objectsmoothly
how to rotate cube smoothly
Hi guys i need to get cube rotate very smoothly but i'm failing to get this here is my code
using UnityEngine; using System.Collections; using System;
public class clockAnimator : MonoBehaviour {
// Use this for initialization
void Start () {
}
private const float
secondsToDegrees = 0.1f;
public Transform seconds;
// Update is called once per frame
void Update () {
DateTime Time = DateTime.Now;
//seconds.localRotation = Quaternion.Euler(0f, 0f,(Time.Millisecond*-secondsToDegrees)*0.03f);
seconds.localRotation = Quaternion.Euler(0,0,Time.Millisecond*-secondsToDegrees);
}
}
Thanks in advance Gokul
Comment
Answer by Jessespike · Apr 24, 2015 at 06:29 PM
Use Time.deltaTime
seconds.Rotate( Quaternion.Euler(0,0,Time.deltaTime * secondsToDegrees).eulerAngles );