Unity 3D 正交(Orthographic)摄像机尺寸学习笔记

在 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?
 // Use this for initialization
 void Start () {
  cam = GetComponent<Camera>(); 
  //Set the size of the camera between middle and max
  cam.orthographicSize = (minSize + maxSize) / 2;

猜你喜欢

转载自blog.csdn.net/One_Piece_Fu/article/details/80980861