# Instance Handles

Shake instance handles can control shakes after they have been triggered. This is particularly useful to control [Endless Shakes](/shakefx/core/endless-shakes.md) (shakes where the **Duration** is set to **Force** instead of **Impulse**).

## Obtaining the handles

Handles are provided to the user when calling `Shake()` methods on ShakeFX components.

{% hint style="info" %}
**ShakeFX Source** components will return a list of handles, one for every **ShakeFX Listener** component that is active in the scene. This handles the [Multi-Camera](/shakefx/core/multi-camera.md) scenario.
{% endhint %}

## Using the handles

A handle supports the following operations:

* `Target`: Gets the target of the shake (the specific listener or component)
* `SetStrengthMultiplier(float strengthMultiplier)`: Sets a strength multiplier. Ex to manually fade a shake in/out, or to drive it based on gameplay (ex based on player sprint speed).
* `Stop()`: Stops all shake instances in this handle, allowing them to fade-out gracefully.
* `StopImmediately()`: Stops all shake instances in this handle immediately without fading out.
* `QueryState(ShakeState state, QueryFilter filter = QueryFilter.All)`: Queries whether the shake instances in this handle match the specified state.

#### QueryState

A shake asset can have multiple shake definitions, so a handle can point to multiple shake instances internally. This is why `QueryState`  exposes a filter option.

<figure><img src="/files/HHyFj8aSzmFKxHvqzMuT" alt="" width="375"><figcaption><p>A multi-shake asset</p></figcaption></figure>

`ShakeState` can be `FadingIn`, `Holding`, `FadingOut`, or `Finished`.

`QueryFilter` can be:

* **Any:** The query returns true if at least one shake instance matches the query.
* **All:** The query returns true only if every shake instance matches the query.

For example to query if the shake is completely finished the operation would be: `QueryFilter(ShakeState.Finished, QueryFilter.All)`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fx-engine.gitbook.io/shakefx/core/instance-handles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
