Skip to content

How to Setup Interaction

Dominik Pavlíček edited this page Feb 17, 2023 · 63 revisions

Table of contents

  1. Download the Plugin
    1. Marketplace
    2. GitHub
  2. Instal the Plugin
    1. Marketplace
    2. GitHub
      1. Game Folder
      2. Engine Folder
  3. Enable the Plugin
    1. Marketplace
    2. GitHub
  4. Open the Project
  5. Before you Start
    1. Collision Channels
      1. Config Files
      2. Project Settings
    2. Interaction Defaults
  6. Interactor Component
    1. Add Component
    2. Setup Component
  7. Interactable Component
    1. Prepare Actor
    2. Add Component

1. Download the Plugin

Marketplace

If you have already the plugin claimed, simply select the plugin and install it to the Engine version you are working with. Marketplace release always supports the last three major releases according to Epic Games policies.

If you don't see your Engine version listed on the Marketplace, you can always download the GitHub release.

GitHub release

If you feel experimental or simply need an older project to work with, the GitHub release page got you covered. All releases are listed HERE.

There are always two versions:

  • ActorInteractionPlugin
  • ActorInteractionPlugin_Binaries

The Binaries version skips the code build when opening the project and is recommended for Blueprint-based projects.


2. Instal the Plugin

Marketplace

Epic Games Launcher does the job for you, so you can continue to another chapter.

GitHub

With the GitHub release, there are two ways to install the plugin. Both have their advantages and disadvantages.

Game Folder

If you instal the plugin in Game Folder, this plugin will be available for this specific project only. If you are using the Blueprint project, it might require creating a dummy C++ class for packaging.

Installation to Game Folder requires you to drop the plugin into: .../ProjectFolder/Plugins

If you have no Plugins folder, simply create a new one.

Engine Folder

If you instal the plugin in Engine Folder, this plugin will be available to all projects using this Version! With Engine Folder you shouldn't need to create a dummy C++ class for packaging.

Installation to Engine Folder requires you to drop the plugin into: .../EngineFolder/EngineVersionFolder/Engine/Plugins/

Engine is usually installed in: C:/Users/{user}/UnrealEngine/{engine_version}


3. Enable the Plugin

Marketplace

If you are opening the project for the first time, you need to enable the plugin in Edit/Plugins/Mountea Framework

It will ask you to restart your Editor.

GitHub

If you are using the GitHub release, the plugin should be installed by default. If not, you need to enable the plugin in Edit/Plugins/Mountea Framework

It will ask you to restart your Editor.


4. Open the Project

If you are opening the project for the first time, you will be greeted by a Welcome Screen. This popup window shows:

  • If you open the project for the first time
  • If a new version is released

Welcome Screen contains useful links as well as full Changelog, so you can see what version with what features.

Welcome Screen requests those data from GitHub page, so if you have no access to the internet, this popup will not show any Changelog information ❗

image


5. Before you Start

Before you start creating any super complex interactions, there are a few steps that must be done. In order to make everything work, you should set up default values and collision channels. So let's start with those annoying configurations before so we can focus on interactions later.

Collision Channels

Actor Interaction Plugin can simply work out of the box with collision channels Engine contains by default, but it is much safer to use custom ones. Fear not, it might sound scary, but it is not at all! I have even prepared those collision channels for you!

Config Files

Open the {project_folder}/Config/DefaultEngine.ini file (works fine in Notepad, but I recommend to use Visual Studio Code).

Search for [/Script/Engine.CollisionProfile].

Once you find this part of the config file, all you have to do is to paste the following lines to the very end.

+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="InteractionTrace")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="InteractionOverlap")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="InteractionHover")

And you have done it!

Project Settings

If you want more user friendly approach, you can do it from the Engine interface. Go to Edit/Project Settings/Collision. image

Once there, you have to manually create those three Collision Channels.

Object Channel

Object Channels are the following ones:

  • InteractionOverlap
  • InteractionHover

Set Default Response to Ignore. image

Trace Channel

Object Channels are the following ones:

  • InteractionTrace

Set Default Response to Ignore. image

Interaction Defaults

Interaction Defaults are a useful way to setup default values and have some safe backup if you accidentally break anything. Current implementation uses Defaults for all Components, in the future there are plans to add Presets, which will be then assignable to Components.

Let's open Edit/Project Settings/Actor Interaction Plugin settings and focus on variables we can set up here. Actor Interaction Plugin is located at the very bottom of the list, under the Mountea Framework category.

image

Editor

Enable Editor Debug

Globally enables/disables Editor Debug. If enabled, you can enable editor debug for each Component. If globally disabled, local settings are considered false.

Widget

Widget Update Frequency

Defines "Tick" frequency for widgets. Actor Interaction Plugin is not using Ticks for any component to keep as good as possible performance. In order to achieve smooth animations for UI, this Widget Update Frequency is used.

It is valued in Seconds, therefore lower the value, the more frequent the update is.

❗ 0.001 is lowest possible value you can set ❗

❗ Very low values might resolve in very poor performance ❗

Interactable Default Widget Class

Widget Blueprint Class which will be used as the Default one.

❗ Only classes which Implement the ActorInteractionWidget Interface are allowed ❗

Interaction Data

Interactable Default Data Table

Data Table reference which will be used as the default one.


6. Interactor

Once all the setup is done, we can finally start using the Interactions Components! And we should start with the Interactor Component, which is easier to set up and doesn't contain that many variables to fiddle with.

Interactor Component provides the active part of the Interaction process, let's imagine it as the player's eyes. Those can be of course assigned to NPCs as well, as this system is not limited to player input, which allows smart NPC behaviours. There are two master components:

  • Interactor Component: DEPRECATED, for legacy projects usage only
  • Interactor Component Base: The new system which is recommended to use

Add Interactor Component

For this scenario, I will use Third Person Example so everyone can follow those steps. Let's open the ThirdPersonCharacter blueprint. We all should see the same screen as this one. image

The next step is to select the +Add Component button and search for Interactor. Actor Interactor Plugin comes with three C++ based classes, which are under the Interaction category and two Blueprint-based classes, which will be under the Custom category. Blueprint classes have BPC prefixes. image

Blueprint classes provide the ability to override and extend C++ logic. By default, there is no extra functionality tied to Blueprint classes so it should not matter which one you choose. I will choose C++ class with this example.

You can choose from three options:

  • Interactor Component: DEPRECATED, please don't use
  • Interactor Component Trace: Basically a tracing laser from a specified location, either eyes or given one
  • Interacto Component Overlap: Passive component used to determine whether overlapping is with a collision of Interactable Component

For our example, I will choose Interactor Component Trace. After you select the Component from the +Add Component menu, you need to compile. You should see this screen. image

Interactor Component Setup

As you can see, there are multiple categories under the Interaction detail tab. The most important ones are all located in the Required category. image

To get the best results, let's select Collision Channel and pick Interaction Trace value we have created in the Collision Setup. This way your tracing won't affect any other channels.

Other options can be left as they are. If you are interested in how they work, each of them has an explanation tooltip and Wiki page. So your Interactor should be good to go as it is. image


7. Interactable

Prepare the Actor

For this scenario, I will create a new Actor to show you the complete setup, however, this logic is translated to existing Actors as well.

Let's create a new Actor and call it BP_InterctableShowcaseActor.

Once the Actor is created, you should see a very similar screen to this one.

In order to have something to interact with, our Actor needs some Mesh! So let's add a simple Cube for this example (but if you want more interesting shapes, check out Unreal Bucket, they have amazing assets!) and work with this one.

Add Interactable Component

Once you have added the Static mesh, you can add Interactable the same way. +Add Component and select Interactable. Like with the Interactor, there are many options to pick from. image

This is the same case we had with Interactor Components. 5 Blueprint classes and 6 C++ classes, where 1 class is DEPRECATED.

  • Interactable Component: DEPRECATED, do not use
  • Interactable Component Auto: Does automatically finishes interaction, no input is needed. Useful for Capture the Flag and similar gamemodes.
  • Interactable Component Hold: Requires input to be held for a specified duration, key E on a keyboard for 3 seconds, for instance.
  • Interactable Component Hover: WIP component which should be working with top down gamemodes and should only react to coursors.
  • Interactable Component Mash: Requires multiple inputs to be pressed within a specified time frame.
  • Interactable Component Press: Requires input to be pressed.

For our example, I will choose Interactable Component Hold. After you select the Component from the +Add Component menu, you need to compile. You should see this screen.

Set Transform

Similarly to Interactor Components there is Interaction Category with Subcategories where all variables are displayed. Interactable Components are different to Interactor Components, because Interactable Components have transforms, while Interactor Components are just attached to the Actor. Interactable Components, on the other hand, can and should be positioned where they belong.

To change the transform of the Interactable Component use the Gizmos. Once you move the Interactable a bit up, you can see that there is Billboard, which shows you where exactly the Component is. This Billboard is visible only in Editor. image

Interactable Component Setup

Same as with Interactor Components, the most important ones are all located in the Required category in the Interaction category. And in the same manner you have setup the Interactor Trace Component, you should setup the Interactable Component. So update the Collision Channel to use InteractionTrace channel and compile. image

Once done, there are two last things to do in the setup to make the interaction work. Those are:

  • Interactable Data
  • Widget Class

Let's go one after another.

Interactable Data

Interactable Data is a way to provide a modular aproach for setup. All you need to do is to create Data Table (or prefererably duplicate the one which comes with the Plugin) and fill that table with values. You can find Interactable Data under Optional category.


Notes
Clone this wiki locally