makeRay()
Reconstruct the world-space ray through a client (pixel) coordinate, matching the shader's per-pixel ray basis. Returns the camera origin + a (non-unit) dir. clientX/clientY are pointer-event coordinates; the canvas's CSS box and backing-store aspect are read, so this needs a browser.
function makeRay(
canvas: HTMLCanvasElement,
frame: CameraFrame,
clientX: number,
clientY: number
): object;Defined in: ray.ts:39
Parameters
| Parameter | Type |
|---|---|
canvas | HTMLCanvasElement |
frame | CameraFrame |
clientX | number |
clientY | number |
Returns
object
dir
dir: Vec3;origin
origin: Vec3;@voxolith/renderer/ray
Ray helpers for picking. Build a world-space ray from a screen tap, test a ray against an axis-aligned box, and walk a dense voxel grid on the CPU. Shared by any game doing click selection or collision.
rayAABB()
Ray vs axis-aligned box; returns entry distance along d (or null on miss).