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.

  • C#

  • JavaScript

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;}


,