> For the complete documentation index, see [llms.txt](https://visualonecompany.gitbook.io/storyframeworkdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://visualonecompany.gitbook.io/storyframeworkdocs/core-components/editor/setting-up-an-interaction.md).

# Setting up an Interaction

Check out **Interaction in a Nutshell** if you'd prefer to watch a video tutorial covering interaction.

{% hint style="danger" %}
Video tutorial coming soon!
{% endhint %}

***

All interactables/interactions implement the `SFInteraction_BPI` blueprint interface to communicate certain functions to and from interactables. This includes an interactables `InteractionData_S` structure. The following points will continue to elaborate on these settings.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2Fqe2LcfmfLEqBSMefDKHg%2Fimage.png?alt=media&amp;token=7a5916dc-f2f3-4f50-8b2d-d5c3f803d253" alt=""><figcaption></figcaption></figure></div>

***

{% stepper %}
{% step %}

### Level Actor

Firstly, we will need to place an actor in the scene that your interaction will be connected to. The easiest approach would be to place the `InteractableBase_BP` actor into your level\ <sup><sub><mark style="color:$info;">(SF > Core > Gameplay > Interaction)<mark style="color:$info;"><sub></sup>

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FjtSByzvBLq50pPu5Ktsx%2Fimage.png?alt=media&amp;token=c6a36f8a-d9d4-4dae-9a2b-cf14535e71de" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Appearance and Collision

Now that we have an actor in the scene representing our interaction, we might want to add scene components (like a mesh for instance) to our interactable. If you're using the `InteractableBase_BP` actor, this can be done by simply hitting the "Add" button in the details panel with your actor selected. Here, you can add any component (static mesh, skeletal mesh, particles, etc) you'd like to this actor.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2Fu8TUchYEDlxf3OFmB7Ud%2Fimage.png?alt=media&amp;token=2986c91b-1881-4a71-a5a2-77237e34fd63" alt=""><figcaption></figcaption></figure></div>

In regards to interaction collision, you'll notice the `InteractableBase_BP` already contains a blue tinted sphere collider. This collider is exclusively used to block the players interaction trace, meaning players are not forced to look directly at your actors mesh to interact with it. The size of this sphere can be modified by clicking on the `InteractionCollision` component in the details panel, or alternatively modifying the `Interaction Collision Size` variable under "Data" in the details panel with your interactable selected.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FEx0qOIfKwFRxz81nt7XG%2Fimage.png?alt=media&amp;token=e45f1161-3f74-48dc-8b7d-4f2eb1b60e12" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Setting General Data

All interactions utilize `General Data`. This is where you define the ID of your object, it's display name, and other useful initial values.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FfiFxKBLQLZ1pc92xAzPF%2Fimage.png?alt=media&amp;token=41497bcb-be6f-4f57-a4c3-13193f301ffe" alt=""><figcaption></figcaption></figure></div>

**Object ID**\ <sup><mark style="color:$info;">Its generally good practice to always give unique interactables their own unique ID, however there are some interaction scenarios that this isn't required.<mark style="color:$info;"></sup>\
**Object Display Name**\ <sup><mark style="color:$info;">The localizable text name of your interactable, primarily used to display through widgets.<mark style="color:$info;"></sup>\
**Interaction Distance**\ <sup><mark style="color:$info;">The distance (From player camera to object, in Unreal Units) at which the player can interact with this object. The interaction system does not use a fixed interaction distance. Instead, each interactable can contain its own unique interaction distance.<mark style="color:$info;"></sup>\
**Input Hold Timer**\ <sup><mark style="color:$info;">How long the player is required to hold the Primary Interact Key before interaction is executed. Leaving this value at "0,0" means an interaction happens immediately upon key press.<mark style="color:$info;"></sup>\
**Quick Action Triggers**\ <sup><mark style="color:$info;">Check out the<mark style="color:$info;"></sup> [<sup><mark style="color:blue;">Quick Actions<mark style="color:blue;"></sup>](https://visualonecompany.gitbook.io/storyframeworkdocs/core-components/editor/quick-actions.md) <sup><mark style="color:$info;">section for more info.<mark style="color:$info;"></sup>
{% endstep %}

{% step %}

### Configuring Advanced Data

`Advanced Data` is where we can begin to define more interesting and specific interaction behaviours for our object.\
\
Let's approach this by comprehending the different interaction layers/phases first and foremost. Upon executing an interaction, the execution flow looks a little something like;\
\
Interact > Execute "On Interact" [Quick Actions](https://visualonecompany.gitbook.io/storyframeworkdocs/core-components/editor/quick-actions.md) > If `Required Item ID` is not empty, then execute "Player Requires Item" layer > Execute Interaction Method logic.\
\
The flow mentioned above should help with understanding when and where values are used.

***

Defining the baseline behaviours are done through the 3 variables shown below,

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FkuidkkG5Y1x6IqitPXiU%2Fimage.png?alt=media&amp;token=58cce7cf-09a5-49b1-8d77-501ba342a5b4" alt=""><figcaption></figcaption></figure></div>

**Interaction Execution Order**\ <sup><mark style="color:$info;">This option should generally be set to its default value (<mark style="color:$info;"></sup><sup><mark style="color:$info;">`Execute Interaction Method Logic Immediately`<mark style="color:$info;"></sup><sup><mark style="color:$info;">). If you're setting up a custom interactable and have custom logic assigned to your custom interactables<mark style="color:$info;"></sup> <sup><mark style="color:$info;"> </sup><sup><mark style="color:$info;">`EventPrimary/SecondaryInteractWith`<mark style="color:$info;"></sup> <sup><mark style="color:$info;"> </sup><sup><mark style="color:$info;">BPI function that you'd like to execute before interaction method logic mentioned below, then use the<mark style="color:$info;"></sup> <sup><mark style="color:$info;"> </sup><sup><mark style="color:$info;">`Manually Execute Interaction Method Logic`<mark style="color:$info;"></sup> <sup><mark style="color:$info;"> </sup><sup><mark style="color:$info;">option.<mark style="color:$info;"></sup>\
**Primary Interaction Method**\ <sup><mark style="color:$info;">The type of interaction to execute upon "Primary Interacting" with your interactable. Interaction types included out-of-the-box are: None/Custom, Inspect, Drag, Physics Grab, and Quick Pickup.<mark style="color:$info;"></sup>\
**Secondary Interaction Method&#x20;**<sup><sub>**(Optional)**<sub></sup>\ <sup><mark style="color:$info;">This is an optional secondary interaction that can be utilized. The available interaction methods here are: None,  Custom, Inspect, and Quick Pickup.<mark style="color:$info;"></sup>\
\ <mark style="color:$tint;">Each interaction method contains its own drop-down within "Advanced Data". This is where you specify how a specific interaction method will execute or behave. Make use of the tooltips that appear when hovering a variable to learn more about how each variable effects an interaction.</mark>

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2F6PkMbcOGVbcFdb2eUBDI%2Fimage.png?alt=media&amp;token=1692b9f6-948e-43c3-ab8c-1931435f11ab" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Managing Prompt Data

Control how your interactables prompt appears and behaves through the `Prompt Data` section.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FsG0O9plscw2Ak0ur5AsK%2Fimage.png?alt=media&amp;token=fd7ddef9-a198-49af-8a5e-b093839de408" alt=""><figcaption></figcaption></figure></div>

**Prompt Widget Override**\ <sup><mark style="color:$info;">Override the "Default" prompt widget assigned in the "Story Framework Values" data asset.<mark style="color:$info;"></sup>\
**Widget Data String (Optional)**\ <sup><mark style="color:$info;">If you'd like your "Prompt" widget to have custom logic per interactable object, then this is where you can assign a custom "Data String" for this objects "Prompt" widget specifically.<mark style="color:$info;"></sup>\
**Primary Interact Text Override**\ <sup><mark style="color:$info;">Override the default "Primary Interact" text displayed on "Prompt" widgets provided with SF out-of-the-box.<mark style="color:$info;"></sup>\
**Secondary Interact Text Override**\ <sup><mark style="color:$info;">Override the default "Secondary Interact" text displayed on "Prompt" widgets provided with SF out-of-the-box.<mark style="color:$info;"></sup>\
**Prompt Fade in Distance**\ <sup><mark style="color:$info;">The distance at which this objects interaction indicator (indicator is included in any "Prompt" widget) and the prompt in its entirety begins to be visible (in uu).<mark style="color:$info;"></sup>\
**Object Outline Color**\ <sup><mark style="color:$info;">Optionally override SF's outline color assigned to this object specifically.<mark style="color:$info;"></sup>
{% endstep %}

{% step %}

### Inspect Focus Points (Extra Feature / Optional)

SF includes a scene component that can be added to any interactable to add further depth to inspection interactions. This adds an interaction on your physical object that is accessible during inspection.\
\
To add an Inspect Focus Point to your interactable, hit the ![](https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FnGa5wiytI6nBlrDskIpm%2Fimage.png?alt=media\&token=ee96f6c5-f3ee-42f5-b9cd-cf1866996363) button in the components hierarchy field within the details panel with your interactable selected (this can also be added to your interactables component hierarchy inside of a custom child blueprint so that every instance of your child interactable contains it without needing to manually add it  in the details panel with your interactable selected in the level viewport) and search for the `FocusPoint_BP` component.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2F23NBYQykWfjOTBZsrmKa%2Fimage.png?alt=media&amp;token=fb36e524-5daa-457a-a34c-1b65ca4cd2a1" alt=""><figcaption></figcaption></figure></div>

With your `FocusPoint_BP` component selected, you'll find general properties for defining a static mesh to appear as well as adjust its position (contains a blue outlined "handle" to move the mesh in the scene instead of modifying the offset values in the details panel)

<figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FU2MU8aEONZuB9pbYohgZ%2Fimage.png?alt=media&amp;token=9ccef2d6-d45d-4162-8486-a27f87f68238" alt=""><figcaption></figcaption></figure>

`Interaction Type` will define the result of an interaction with your focus point.&#x20;

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FOpepSxoEOArdZI2qWEY1%2Fimage.png?alt=media&amp;token=df4e5215-38d3-4e0e-be11-83fd945178ec" alt=""><figcaption></figcaption></figure></div>

**None**\ <sup><mark style="color:$info;">Simply executes this focus points "On Interact Quick Actions" and display any readable if setup. Nothing further.<mark style="color:$info;"></sup>\
**Destroy Focus Point**\ <sup><mark style="color:$info;">Executes the same behaviour as "None", but immediately "destroys / removes" this focus point and its static mesh. Useful for one-time focus points.<mark style="color:$info;"></sup>\
**Stop Interaction For Duration**\ <sup><mark style="color:$info;">Executes the same behaviour as "None", but will disable interaction with this focus point for a few seconds at which point it will be re-enabled.<mark style="color:$info;"></sup>

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2F7ZDkxJLGcPaX9TuYJUFK%2Fimage.png?alt=media&amp;token=17246d74-5101-43e0-a18f-6cd3895c82e6" alt=""><figcaption></figcaption></figure></div>

Focus Points inherintly support readables upon interaction. You can define what data appears in the readable widget under the `Readable Data (If Readable)` section. Uncheck `Open Readable on Interact` to disable the readable popup for this focus point.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FaNda2mOYoVpbG3kFEQbc%2Fimage.png?alt=media&amp;token=15b688b9-7eff-482f-8f9a-fdd5de1b3f69" alt=""><figcaption></figcaption></figure></div>

Adjusting the location of where the interaction prompt appears can be done by modifying the offset values of the `Interaction Prompt Offset` value (contains a blue outlined "handle" to move the prompt offset in the scene instead of modifying the offset values in the details panel).
{% endstep %}
{% endstepper %}

***
