世界座標
世界座標系,是現實物體在空間的位置。
獲取GameObject的世界座標:transform.position
世界座標轉屏幕座標
Vector3 screenPos = Camera.WorldToScreenPoint(worldPos.Position);
屏幕座標
屏幕左下角爲(0,0),右上角爲(Screen.width,Screen.height)
鼠標座標與其一致。Input.mousePosition
觸屏座標也與其一致。Input.GetTouch(0).position
Screen.width = Camera.pixelWidth;
Screen.height = Camera.pixelHeight;
z的單位是以相機的世界單位來衡量的
屏幕座標轉視口座標
Camera.ScreenToViewpostPoint()
視口座標
屏幕左下角爲(0,0),右上角爲(1,1)
又名用戶座標、客戶區座標
z的單位是以相機的世界單位來衡量的
視口座標轉屏幕座標
Camera.ViewportToScreenPoint()
視口座標轉世界座標
Camera.ViewportToWorldPoint()
GUI座標
屏幕左上角爲(0,0),右下角爲(Screen.width,Screen.height)