# PickHit

> Talos next · Since 0.7

What `ctx.camera.pick` answers: a {@link Hit}, whose `entity` is `null` for the ground-plane fallback.

## Signature

```ts
export interface PickHit extends Omit<Hit, "entity"> {
  /** The entity the ray hit; `null` when it met the `ground` plane instead of a collider. */
  entity: EntityHandle | null
}
```

Import: `import type { PickHit } from "@argus/api"`

## Members

| Member | Signature | Description |
|---|---|---|
| `entity` | `entity: EntityHandle \| null` | The entity the ray hit; `null` when it met the `ground` plane instead of a collider. |

## Example

The tested fixture `fixtures/recipes/drone-search/scenes/behaviors/carrier.ts`.

```ts
import type { Behavior } from "@argus/api"

/** Moves a kinematic body round `props.path` (world [x, z] points) at `props.speed` m/s, facing where it goes: the
 * stand-in for a boat or a truck the drone launches from, and for the contact it looks for. */
interface Props {
  path: [number, number][]
  speed: number
}

interface State {
  next: number
}

export default {
  init(ctx) {
    ctx.state.next ??= 0
  },
  update(ctx, dt) {
    const path = ctx.props.path
    const goal = path[ctx.state.next % path.length]
    if (goal === undefined) return
    const p = ctx.entity.position
    const to: [number, number, number] = [goal[0], p[1], goal[1]]
    ctx.entity.lookAt(to)
    if (ctx.entity.moveToward(to, ctx.props.speed * dt)) ctx.state.next = (ctx.state.next + 1) % path.length
  },
} satisfies Behavior<State, Props>
```
