Camera’s half-size when in orthographic mode.
The orthographicSize is half the size of the vertical viewing volume.
The horizontal size of the viewing volume depends on the aspect ratio.
orthographicSize = vertical viewing volume(视域的垂直高度)/ 2;
视域的水平宽度取决于屏幕的长宽比;
使用官方代码实现的示例效果(orthographic和perspective的对比,左下角小屏为orthographic):

推荐一个不错的教程(视频可能需要翻墙才能看),有助于深刻理解orthographicSize的作用
模仿该教程写了一个适配效果的例子,让球场能够在不同分辨率下尽量充满屏幕完整显示。
targetRatio >= screenRatio的情况:

本文介绍了Unity中相机的正交模式下orthographicSize的含义,它是垂直视域的一半。视域的水平大小由屏幕的纵横比决定。文中通过示例代码展示了orthographicSize在不同场景中的应用,并推荐了一个教程帮助理解其作用。同时,提供了适配不同分辨率屏幕的正交相机示例代码,确保球场始终能完整显示。

1万+

被折叠的 条评论
为什么被折叠?



