format
typescript
Camera.ViewportPointToRay(point)class: Camera
description
Returns a ray from the camera through a viewport point.
The generated ray is in world space, starting from the camera's near plane and passing through the specified coordinates on the viewport.
parameter
| param_name | type | description |
|---|---|---|
| point | Vector3 | The viewport coordinates used to emit the ray. |
reture
| type | description |
|---|---|
Ray |
code example
typescript
let camera = this.gameObject.GetComponent<Camera>(Camera);
camera.ViewportPointToRay(new Vector3(1,1,1));