前言
最近研究Camera时被Screen, Viewport 和 Rect 三者的关系搞得有点晕,所以临时决定总结一下它们之间的关系。
概念
Screen Space & Viewport Space
以下是来源于Unity Scripting API中Camera类的原文
A Camera is a device through which the player views the world.
A screen space point is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth,pixelHeight). The z position is in world units from the Camera.
A viewport space point is normalized and relative to the Camera. The bottom-left of the Camera is (0,0); the top-right is (1,1). The z position is in world units from the Camera.
A world space point is defined in global coordinates (for example, Transform.position).
我个人对它的理解如下:
相机是一种玩家用来观察游戏世界的设备。
Screen space 和 viewport space 都是关联于某个