format
typescript
Camera.ScreenPointToRay(point)class: Camera
description
Create a raycast from a screen point.
The generated ray is in world space, starting from the camera's near plane and passing through the specified pixel coordinates on the screen.
parameter
| param_name | type | description |
|---|---|---|
| point | Vector3 | The screen coordinates used to cast the ray. |
reture
| type | description |
|---|---|
Ray | A ray from the camera's near plane, passing through the position (x,y) in pixel coordinates on the screen. |
code example
typescript
let camera = this.gameObject.GetComponent<Camera>(Camera);
camera.ScreenPointToRay(new Vector3(1,1,1));