1681-engine / index / pickInView
Function: pickInView() ​
ts
function pickInView<T>(
items,
view,
random,
tries?
): T | null;Defined in: src/ambient/life/lifeMotion.ts:41
One of items in view, tried tries times at random rather than filtered: a forest's thousands of tiles cost the same few reads as a hamlet's dozen, and a miss only means the body waits a frame to try again.
Type Parameters ​
| Type Parameter |
|---|
T extends LifeBox |
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
items | readonly T[] | undefined |
view | ViewRect | undefined |
random | () => number | undefined |
tries | number | 8 |
Returns ​
T | null