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

スクリプト言語

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

Camera.OnPreCull()

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

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);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void OnPreCull() {
        camera.ResetWorldToCameraMatrix();
        camera.ResetProjectionMatrix();
        camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1));
    }
    void OnPreRender() {
        GL.SetRevertBackfacing(true);
    }
    void OnPostRender() {
        GL.SetRevertBackfacing(false);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def OnPreCull() as void:
		camera.ResetWorldToCameraMatrix()
		camera.ResetProjectionMatrix()
		camera.projectionMatrix = (camera.projectionMatrix * Matrix4x4.Scale(Vector3(1, -1, 1)))

	def OnPreRender() as void:
		GL.SetRevertBackfacing(true)

	def OnPostRender() as void:
		GL.SetRevertBackfacing(false)