标签:unity3d
世界坐标系,是现实物体在空间的位置。
获取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()
屏幕左上角为(0,0),右下角为(Screen.width,Screen.height)
标签:unity3d
原文地址:http://blog.csdn.net/lihuozhiling0101/article/details/42773883