言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Camera.OnPreCull()

Switch to Manual

Description

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

カリングはカメラから見えるオブジェクトに対して行われます。OnPreCullはカリングが行われる直前に呼び出されます。 このメッセージはカメラにアタッチされている全てのスクリプトに送られます。 もしカメラの見えている範囲(例: fieldOfView または transform)を変えたい場合に、 このメッセージを使います。シーンオブジェクトの可視性は /OnPreCull/ 後のカメラのパラメーターを基にして決定されます。

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