Skip to content

格式

typescript
Camera.ScreenPointToRay(point)

所属类: Camera

描述

创建通过屏幕点的射线。

产生的光线位于世界空间中,从摄像机的近平面开始,并通过屏幕上指定像素坐标

参数

参数名类型描述
pointVector3用于发射射线的屏幕坐标。

返回值

类型描述
Ray从摄像机的近平面开始,并通过屏幕上 位置的 (x,y) 像素坐标的射线。

代码示例

typescript
let camera = this.gameObject.GetComponent<Camera>(Camera);
camera.ScreenPointToRay(new Vector3(1,1,1));