Skip to content

格式

typescript
Camera.ViewportPointToRay(point)

所属类: Camera

描述

返回从摄像机通过视口点的光线。

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

参数

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

返回值

类型描述
Ray

代码示例

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