1
This commit is contained in:
31
Assets/Plugins/Trails FX/Demo/Scripts/RotateObject.cs
Normal file
31
Assets/Plugins/Trails FX/Demo/Scripts/RotateObject.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user