Question by
beugen · Sep 13, 2015 at 02:04 PM ·
rotationspot light
Rotating spot light
Hi,
I want to rotate a spot light arount Y Axis. I have written the followin script and attached it to the spot light: using UnityEngine; using System.Collections;
public class RotateSpot : MonoBehaviour {
public float rotateSpeed = 10f;
float xangle;
float zangle;
// Use this for initialization
void Start () {
float xangle = transform.rotation.x;
float zangle = transform.rotation.z;
}
// Update is called once per frame
void Update () {
transform.Rotate(new Vector3(xangle, Time.deltaTime*rotateSpeed, zangle));
}
}
But the spot does not rotate, more it disappears. How to improve the script ?
Thank you.
Comment