# Interactable component

## Functions

### 1. Activate/Deactivate

Works like any other component in unreal engine, if deactivated it will not show the UI nor overlay. Interaction will be disabled.

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2FCHL88Zyv17pm2RAXmh3p%2Fimage.png?alt=media&#x26;token=c4545928-9a82-42d6-9691-87940c3496b5" alt=""><figcaption></figcaption></figure>

### 2. Set Interactable Name Text

This is the text that shows up bolded inside the user interface widget.

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2FuowtLoD2h0PG7YCEWVUT%2Fimage.png?alt=media&#x26;token=36b2e032-d3dc-4901-96ec-280e6c7b267c" alt=""><figcaption></figcaption></figure>

### 3. Set Interactable Action Text

This is the text that shows up after the "Press/Hold E to {Action}". It is the verb that describes the action that happens when you interact with the object (Sit, Drink, Pickup, etc.)

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2FiFjLbC3SptR7wRQaKQxo%2Fimage.png?alt=media&#x26;token=79612b4c-0e19-450b-ac25-4690577e425d" alt=""><figcaption></figcaption></figure>

### 4. On Begin/End Interact

These events get called when the player only presses to interact or lets go of the key to interact. If you have, for an example, a pickup to interact with you should use On Interact to open it.

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2FREiLJEmhRceD9uZFt36M%2Fimage.png?alt=media&#x26;token=7c047d6d-4ff4-4c43-b863-a41c830063ea" alt=""><figcaption></figcaption></figure>

### 5. On Begin/End Focus

These events get called when the player looks at an interactable or looks away. They do not control the actual interaction of the interactable.&#x20;

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2F5L9lhpGlVKxCgXOjAIQj%2Fimage.png?alt=media&#x26;token=a4451106-c613-4789-ad37-47836990967e" alt=""><figcaption></figcaption></figure>

### 6. On Interact

This events gets called when the player finishes the interaction, it also means the Can Interact checks were valid. This event should be use to do your custom functionality, as picking up an item.

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2F76dDyF2CH0R8TEupePBS%2Fimage.png?alt=media&#x26;token=c8c16e58-f4ac-472b-9bd5-ed5ea748064e" alt=""><figcaption></figcaption></figure>

### 7. Can Interact

In this function, you can implement custom checks that need to be completed for the player to be able to interact. The **Parent: Can Interact** is the c++ override if you have one (Yes, this can also be overidden in c++ as all the other events).

<figure><img src="https://2523857298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkfcusXmYdv33CDQzNCZB%2Fuploads%2Ff6rmc5aTDUXkVCQhlQVp%2Fimage.png?alt=media&#x26;token=93d027c3-95cd-46e7-bed4-2a3add9c4e6a" alt=""><figcaption></figcaption></figure>

## Properties

The interactable comes with properties that allow for dynamic interaction. Here is a table with all properties you can modify:

<table><thead><tr><th>Property</th><th width="302">Description</th><th>Default Value</th></tr></thead><tbody><tr><td>Interaction Distance</td><td>The maximum distance that this interactable can be interacted from (in unreal units).</td><td>200</td></tr><tr><td>Interaction Time</td><td>How long it takes to interact with this interactable.</td><td>0</td></tr><tr><td>Interactable Name Text</td><td>The name of the interactable to show in the UI.</td><td>"Interactable"</td></tr><tr><td>Interactable Action Text</td><td>The action to show in the UI (eg. Sit, Drink, Pickup).</td><td>"Interact"</td></tr><tr><td>Focused Overlay Material</td><td>The material to show on top of any mesh components inside the interactable.</td><td>NULL</td></tr></tbody></table>
