BITFALL/Assets/Plugins/Trails FX/Demo/Scripts/RotateObject.cs

31 lines
467 B
C#
Raw Normal View History

2023-11-02 20:58:55 +08:00
using UnityEngine;
namespace TrailsFX.Demos {
public class RotateObject : MonoBehaviour
{
public float speed = 100f;
Vector3 eulerAngles;
void Start ()
{
SetAngles ();
}
void Update ()
{
transform.Rotate (eulerAngles * (Time.deltaTime * speed));
if (Random.value > 0.995f) {
SetAngles ();
}
}
void SetAngles ()
{
eulerAngles = new Vector3 (Random.value - 0.5f, Random.value - 0.5f, Random.value - 0.5f);
}
}
}