Camera.OnPreCull 在消隐之前

function CopyFrom (other : Camera) : void


OnPreCull is called before a camera culls the scene.


Culling determines which objects are visible to the camera. OnPreCull is called just before this process. This message is sent to all scripts attached to the camera.

裁剪决定哪个物体对于相机来说是可见的。OnPreCull 仅仅在这个过程之间被调用,这个消息被发送到所有附加的相机的脚本。

If you want to change camera's viewing parameters (e.g. fieldOfView or just transform), this is the place to do it. Visibility of scene objects will be determined based on camera's parameters after OnPreCull.

如果你想改变相机的视觉参数(例如:  fieldOfView 或者仅仅是变换),就在这里做这个,场景物体的可见性将基于相机的参数在OnPreCull 之后确定。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnPreCull() {
		camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1));
	void OnPreRender() {
	void OnPostRender() {
// Attach this to a camera. 附加这个到相机
// Inverts the vie of the camera so everything rendered by it, is flipped
// This will only work on Unity - PRO 仅工作在Unity专业版

function OnPreCull () {
	camera.ResetWorldToCameraMatrix ();
	camera.ResetProjectionMatrix ();
	camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(Vector3 (1, -1, 1));
// Set it to true so we can watch the flipped Objects
function OnPreRender () {
	GL.SetRevertBackfacing (true);

// Set it to false again because we dont want to affect all other cammeras.
function OnPostRender () {
	GL.SetRevertBackfacing (false);
Page last updated: 2011-3-7