# Interaction Manager

<div align="left"><figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FOXndO6hKeLj0uEuE8Vaf%2FActorComponent_64x.png?alt=media&#x26;token=b00844b2-cbc3-4f89-9f4b-d2c8e193007c" alt=""><figcaption></figcaption></figure></div>

The **Interaction Manager (AC\_InteractionManager)** handles interactions between the player and nearby interactables. It also manages target locking and target switching for combat.

It is added to the **Character** class by default **(B\_Soulslike\_Character).**

### **How It Works**

1. **Detecting Interactables**:
   * Continuously (on a reasonable interval) traces nearby **Interactable** objects.&#x20;
   * Maintains a list of detected objects and shows the interaction widget for the closest object.
2. **Target Locking**:
   * Upon request, tries to locks onto the nearest valid **Enemy** target and updates the camera and player orientation accordingly.
3. **Target Switching**:
   * Allows switching between nearby targets based on input (e.g., cycling through enemies during combat).
   * Ensures smooth transitions with minimal disruption to gameplay.

### Example Usage

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FkkeMv7sxWeY3Pcr50JMc%2Fimage.png?alt=media&#x26;token=75edf9f3-6cfc-4523-9b09-bd8e0df302da" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FcJN8vuG22xhzfSqgecgw%2Fimage.png?alt=media&#x26;token=5b496344-a85e-440f-beed-7970f8b484b4" alt=""><figcaption><p>Tracing for Interactables</p></figcaption></figure>

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FcMEdsCdH2zdNkq8quZFm%2Fimage.png?alt=media&#x26;token=d55296eb-f882-4bf6-95b7-45da7a58599f" alt=""><figcaption><p>Target Locking related traces</p></figcaption></figure>
