> For the complete documentation index, see [llms.txt](https://black-horizon-studios.gitbook.io/emerald-ai-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-horizon-studios.gitbook.io/emerald-ai-wiki/emerald-components-optional/sound-detector-component/using-an-attract-modifier.md).

# Using an Attract Modifier

## Using an Attract Modifier

The Attract Modifier will attract AI that are within range and invoke the "Attract Reaction". The object the Attract Modifier is attached to will be the source of attraction. This system is intended to extend the functionality of the Sound Detector Component by allowing certain objects, collisions, and custom calls to attract nearby AI.

<figure><img src="/files/AacP1GEfg4kquKFelgYv" alt=""><figcaption></figcaption></figure>

### Step 1

Find the AttractModifier script by searching for AttractModifier within the Project tab. Drag and drop it on the object you'd like to have attract AI (stone, box, etc.).

<figure><img src="/files/kLhyUSGxyWuG5Vu6UAt1" alt=""><figcaption></figcaption></figure>

### Step 2

After you have added an AttractModifier to your object, you will need to specify your Emerald AI Layer. When the AttractModifier is triggered, it will send information to all detected AI with this layer that are in range, but only to the Emerald AI Layer.

<figure><img src="/files/6RHYTNMwIbI3ndEuaPqg" alt=""><figcaption></figcaption></figure>

### Step 3

Next, you will need to assign a Reaction Object. For this tutorial, just use the included Move To Attract Source (Attract Modifier) example.

<figure><img src="/files/xUbyAe81QXTj0L944oBc" alt=""><figcaption></figcaption></figure>

### Step 4

Adjust the Attract Modifier settings as needed. There are options to have the Attract Modifier triggered OnStart, OnTrigger, OnCollision, and with a custom call. Ensure you have a [Rigidbody Component](https://docs.unity.cn/560/Documentation/Manual/class-Rigidbody.html) on your game object if your Attract Modifier will be using OnTrigger or OnCollision.

<figure><img src="/files/m6zCgNCctxOLw5Kl3eCt" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://black-horizon-studios.gitbook.io/emerald-ai-wiki/emerald-components-optional/sound-detector-component/using-an-attract-modifier.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
