Skip to content

1681-engine / index / pickTarget

Function: pickTarget() ​

ts
function pickTarget(
   from, 
   dir, 
   bodies, 
   range?, 
   cone?
): number | null;

Defined in: src/input/TargetLock.ts:35

The body a drag in direction dir (any length > 0) picks from from, or null. Scored by how far off the drag's line it stands, with distance as a lighter second weight, so a far body dead ahead beats a near one off to the side.

Parameters ​

ParameterTypeDefault value
fromPointundefined
dirPointundefined
bodiesreadonly LockBody[]undefined
rangenumberLOCK_PICK_RANGE
conenumberLOCK_PICK_CONE

Returns ​

number | null

Released under the MIT License.