# QueryFilter

> Talos 0.6 · Since 0.6

Filter for {@link WorldQuery.query}; every given field must match.

## Signature

```ts
export interface QueryFilter {
  tag?: string
  component?: string
  /** Within `radius` metres (default 1) of this point or entity. */
  near?: Target
  radius?: number
  /** Inside the bounds of this trigger volume or entity (by id or handle). */
  inside?: string | EntityHandle
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `tag` | `tag?: string` |  |
| `component` | `component?: string` |  |
| `near` | `near?: Target` | Within `radius` metres (default 1) of this point or entity. |
| `radius` | `radius?: number` |  |
| `inside` | `inside?: string \| EntityHandle` | Inside the bounds of this trigger volume or entity (by id or handle). |

## Example

The tested fixture `fixtures/host/door.ts`.

```ts
import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
  update(ctx) {
    const player = ctx.world.find("player")
    const near = player !== null && ctx.entity.distanceTo(player) < 2
    ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
  },
} satisfies Behavior
```
