Light.spotAngle 聚光角度
var spotAngle : float
Description描述
The light's spotlight angle in degrees.
灯光的聚光角度。
Used primarily for Spot lights. Alters the light cookie size on Directional lights. No effect for Point lights
主要用于聚光灯,改变Directional灯光的cookie大小,对Point灯光没有影响。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float interval = 0.3F;
public float minAngle = 10;
public float maxAngle = 90;
private float timeLeft;
void Update() {
timeLeft -= Time.deltaTime;
if (timeLeft < 0.0F) {
timeLeft = interval;
light.spotAngle = Random.Range(minAngle, maxAngle);
}
}
void Awake() {
timeLeft = interval;
light.type = LightType.Spot;
}
}
// Change spot angle randomly between 'minAngle' and 'maxAngle'
// each 'interval' seconds.
//改变聚光角度,在随机范围minAngle和之间
//每'interval'秒改变一次.
var interval : float = 0.3;
var minAngle : float = 10;
var maxAngle : float = 90;
private var timeLeft : float;
timeLeft = interval;
light.type = LightType.Spot;
function Update () {
timeLeft -= Time.deltaTime;
if (timeLeft < 0.0) {
// time to change!
timeLeft = interval;
light.spotAngle = Random.Range( minAngle, maxAngle );
}
}
最后修改:2011年3月30日 Wednesday 12:25