Version: 2022.3
言語: 日本語
public Matrix4x4 cullingMatrix ;

説明

すべてのカリングクエリに使うためのカメラのカスタムマトリクスを設定します。

これは ResetProjectionMatrix を呼び出すまで続きます。

カスタムのカリングマトリクスは、リフレクションなどのエフェクトをレンダリングするために複数のカメラをまったく同じようにカリングする必要がある場合に役立ちます。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { Camera cullingCamera;

void Awake() { cullingCamera = gameObject.AddComponent<Camera>(); SetMainCameraCustomCullingMatrix(new Vector3(10.0f, 10.0f, 10.0f), Vector3.zero); }

void SetMainCameraCustomCullingMatrix(Vector3 cameraPosition, Vector3 lookAtPosition) { transform.position = cameraPosition; transform.LookAt(lookAtPosition); Camera.main.cullingMatrix = cullingCamera.projectionMatrix * cullingCamera.worldToCameraMatrix; }

void ResetMainCameraCullingMatrix() { Camera.main.ResetCullingMatrix(); } }