Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unity 2017.2.0b10で、Immersiveヘッドセット向け描画でNearClipとFarClipを変更するためのUnityコンポーネント
using UnityEngine;
public class ProjectionMatrixSetter : MonoBehaviour {
Camera main;
[SerializeField]
float nearClip = 0.01f;
[SerializeField]
float farClip = 500.0f;
[SerializeField]
float fieldOfView = 102.0456f;
private void Start() {
main = Camera.main;
var projection = Matrix4x4.Perspective(fieldOfView, 1440.0f / 1440.0f, nearClip, farClip);
main.SetStereoProjectionMatrix(Camera.StereoscopicEye.Left, projection);
main.SetStereoProjectionMatrix(Camera.StereoscopicEye.Right, projection);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment