castRay

expect fun castRay(origin: Vec2, translation: Vec2, filter: QueryFilter = QueryFilter.Default, callback: (Shape, Vec2, Vec2, Float) -> Float): TreeStats

Cast a ray against the world. The callback is called for each shape hit. Return the fraction to clip the ray for the next hit, 0 to terminate, or 1 to not clip.

Return

Tree traversal statistics

Parameters

origin

The starting point of the ray

translation

The ray direction and length

filter

Query filter to select which shapes to test

callback

Called for each shape hit. Parameters: shape, point, normal, fraction. Return fraction to clip.