You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
798 B

using UnityEngine;
using System.Collections;
public class Rotator : MonoBehaviour
{
public float SpinSpeed = 1.0f;
public Vector3 Axis =new Vector3(0, 1, 0);
//float X, Y, Z;
[SerializeField]
Material Skybox;
public bool rotateSky = false;
float time;
void Start()
{
// X = transform.eulerAngles.x;
// Y = transform.eulerAngles.y;
// Z = transform.eulerAngles.z;
}
void FixedUpdate()
{
time += Time.deltaTime;
//transform.eulerAngles = new Vector3(X + time * SpinSpeed * Axis.x, Y + time * SpinSpeed* Axis.y, Z + time * SpinSpeed * Axis.z);
transform.Rotate(Axis, SpinSpeed, Space.World);
if (rotateSky && Skybox)
Skybox.SetFloat("_Rotation", -transform.eulerAngles.y);
}
}