在 Unity 3D 中可以把摄像机设置为正交。正交摄像机与 Unity 3D 中普通摄像机相比没有透视效果(近大远小),所以正交相机一般可以用于 2D 游戏开发或者是 3D 游戏的 UI 开发。
Camera cam;
public int minSize; //How far can the player zoom in?
public int maxSize; //How far can the player zoom out?
public int maxSize; //How far can the player zoom out?
// Use this for initialization
void Start () {
cam = GetComponent<Camera>();
//Set the size of the camera between middle and max
cam.orthographicSize = (minSize + maxSize) / 2;
void Start () {
cam = GetComponent<Camera>();
//Set the size of the camera between middle and max
cam.orthographicSize = (minSize + maxSize) / 2;