public class daynight : MonoBehaviour {
// Use this for initialization
public Light dayNight;
public float rychlostDne;
// Update is called once per frame
void FixedUpdate () {
dayNight.enabled = true;
dayNight.transform.Rotate (Vector3.right * rychlostDne * Time.deltaTime);
if (dayNight.transform.rotation.x <= 230) {
Debug.Log ("vypno");
dayNight.enabled = false;
}
}
}
This doesn’t work as Unity handles angles in an awkward way. Just check if the dot product of the forward vector of the light and the global up vector is less than arccos(x), where is x is your desired space angle from the global up vector.