Camera.layerCullDistances 层消隐距离

var layerCullDistances : float[]

Description描述

Per-layer culling distances.

每层的消隐距离。

Normally Camera skips rendering of objects that are further away than farClipPlane. You can set up some Layers to use smaller culling distances using layerCullDistances. This is very useful to cull small objects early on, if you put them into appropriate layers.

通常相机跳过渲染对象是远于farClipPlane,你可以使用layerCullDistances设置某些层使用较小消隐距离,这是非常有用于早期的小物体,如果你把它们放在适当的层。

When assigning layerCullDistances, you need to assign float array that has 32 values. Zero values in cull distances means "use far plane distance".

当分配layerCullDistances,你需要指定的float数组有32个值。0值的消隐距离意思是使用远剪裁屏幕距离。

参见:farClipPlane.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		float[] distances = new float[32];
		distances[10] = 15;
		camera.layerCullDistances = distances;
	}
}
function Start () {
	var distances = new float[32];
	// Set up layer 10 to cull at 15 meters distance.
	// All other layers use the far clip plane distance.
	//设置层10的消隐为15米距离,其他所有层使用远剪裁屏幕距离
	distances[10] = 15;
	camera.layerCullDistances = distances;
}
最后修改:2011年3月6日 Sunday 22:03

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。