How would you rotate smoothly?
How can I rotate smoothly to a random.range angle from the current?
using UnityEngine;
using System.Collections;
public class RotateArms : MonoBehaviour {
public Vector3 rotation;
public float Points;
// Use this for initialization
void Start () {
InvokeRepeating ("rotaFunction", 1, 1);
}
// Update is called once per frame
void Update () {
if (Points <= 45){
Points = (int)(Time.timeSinceLevelLoad);
}
transform.Rotate(rotation * (Time.deltaTime));
}
void rotaFunction(){
rotation = new Vector3 (0, Random.Range (-90 + ((Points*2) *-1), 90 + (Points*2)), 0);
}
}
Comment