Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Camera.OnPreCull()

マニュアルに切り替える

説明

OnPreCull はカメラがシーンのカリングを行う直前に呼び出されます。

カリングはカメラから見えるオブジェクトに対して行われます。OnPreCull はカリングが行われる直前に呼び出されます。 このメッセージはカメラにアタッチされているすべてのスクリプトに送られます。

もしカメラの見えている範囲(例: fieldOfView 、 transform )を変えたい場合に、 このメッセージを使います。シーンオブジェクトの可視性は OnPreCull 後のカメラのパラメーターを基にして決定されます。

参考: onPreCull デリゲート

	// Attach this to a camera.
// Inverts the view of the camera so everything rendered by it is flipped
	
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { Camera camera; void Start() { camera = GetComponent<Camera>(); } void OnPreCull() { camera.ResetWorldToCameraMatrix(); camera.ResetProjectionMatrix(); camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1)); } // Set it to true so we can watch the flipped Objects void OnPreRender() { GL.SetRevertBackfacing(true); } // Set it to false again because we dont want to affect all other cammeras. void OnPostRender() { GL.SetRevertBackfacing(false); } }