public Transform clip;
// Start is called before the first frame update
void Start()
{
clip.position = Camera.main.transform.position + Camera.main.transform.forward * Camera.main.farClipPlane / 2;
var p0 = Camera.main.ScreenToWorldPoint(Vector3.zero);
var p1 = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height));
clip.localScale = new Vector3
{
x = (p1.x - p0.x) / 10,
y = 1,
z = (p0.y - p1.y) / 10
};
}
Unity 让一个平面(Plane)在正交摄像头下全屏
最新推荐文章于 2025-03-27 14:15:17 发布