2025-09-24 11:24:38 +05:00

31 lines
627 B
C#

using UnityEngine;
using System.Collections;
public class FPSRandomRotateAngle : MonoBehaviour
{
public bool RotateX;
public bool RotateY;
public bool RotateZ = true;
private Transform t;
// Use this for initialization
void Awake ()
{
t = transform;
}
// Update is called once per frame
void OnEnable ()
{
var rotateVector = Vector3.zero;
if (RotateX)
rotateVector.x = Random.Range(0, 360);
if (RotateY)
rotateVector.y = Random.Range(0, 360);
if (RotateZ)
rotateVector.z = Random.Range(0, 360);
t.Rotate(rotateVector);
}
}