Pass:getViewRay
EditReturns a world space ray for a pixel in the Pass's canvas. This is useful for interacting with objects with the mouse. This uses the current pose and projection of the camera, previously set using Pass:setViewPose and Pass:setProjection.
x, y, z, dx, dy, dz = Pass:getViewRay(x, y, view)Arguments
| Name | Type | Default | Description |
| x | number | The x coordinate of the pixel. | |
| y | number | The y coordinate of the pixel. | |
| view | number | 1 | The view (camera) to get the ray for. |
Returns
| Name | Type | Description |
| x | number | The x coordinate of the origin of the ray (on the near plane of the camera). |
| y | number | The y coordinate of the origin of the ray (on the near plane of the camera). |
| z | number | The z coordinate of the origin of the ray (on the near plane of the camera). |
| dx | number | The x component of the ray's direction (normalized). |
| dy | number | The y component of the ray's direction (normalized). |
| dz | number | The z component of the ray's direction (normalized). |
Notes
The upper-left of the canvas is located at (0,0).