Advanced Interact System

Where we will arrive after this documentation stage:

For this step of the documentation, I will use the first person template.

If you haven't looked at the Overview page, I recommend you take a look, as here I will skip some steps that I already explained on the Overview page.

We will make two items, a lamp that can be turned on and a key that will be destroyed.

(The items I'm going to use are part of the Unreal engine's "StartContent" , The key I'm using here, I got from FAB for free, search for "Key" in FAB and filter by free.)

Captura de tela 2025-01-27 165759.png

But before creating the objects, let's adjust some values to make the system work well.


Adjusting settings to use the system

-Creating and adjusting a trace

This step was already mentioned on the Overview page, but here I will go into more detail in the explanation.

So let's start from the beginning.

Click on "Edit", this button is in the top left.

Captura de tela 2025-01-19 103529.png

A window will open, click on "Project Settings”

Captura de tela 2025-01-19 103701.png

In the Project Settings window, look for "Collision”

Captura de tela 2025-01-19 103845.png

In the Collision window, click on "New trace Channel”

Captura de tela 2025-01-19 104051.png

Enter the name of your preference, I entered "LookAtObject". Choose "Overlap" in "Default Response".

Captura de tela 2025-01-19 105021.png


-What to do if your project has more than one trace created?

If this is your case, try to leave this trace that we created now first in the list of traces, if you can't leave it first, you need to change some things in the component.

Let's correctly configure the trace in the component.

Open this component:

Captura de tela 2025-01-27 155706.png

Inside the component, you will find the following functions:

Captura de tela 2025-01-27 160614.png

Open both functions.

Open any of the functions and find the "Line trace by channel" node

Captura de tela 2025-01-27 160949.png

Note that this node has the "Trace channel" input, see if it is configured with the trace we created a moment ago, if it is not, change it to the trace we created.

Captura de tela 2025-01-27 161246.png

Repeat the same process for the other function.

Now let's look at the other component, check if the trace is also correct there.

Open this component.

Captura de tela 2025-01-28 212003.png

Look for this function and open it.

Captura de tela 2025-01-28 212102.png

Let's focus on this logic where the square is covering.

Captura de tela 2025-01-28 212206.png

Zooming in on this part of the logic, you will find the nodes in the image below. See if they are blocking the trace we created. If not, adjust them to block the trace.

Captura de tela 2025-01-28 212359.png

After that, you can close the components.

Now we have the trace in the correct way for the system to work, let's continue!


-Adjusting the player

Open your player's blueprint to adjust some values there.

By clicking on the component, you will see the variables that we will adjust for the system to work.

Captura de tela 2025-01-27 162837.png

See the table below to see what each variable does before changing them:

Input Name What it does
Base Class to Interact Irrelevant to this mode of interaction
Interact Mode Active Choose the interaction mode you will use
Is Hold Button? Are you going to use the button-hold system to interact?
Select Hold Widget What the Hold Button Widget will look like
Hold Multiplier Set how long it will take to interact with the Hold Button
Lenght To Check Object How far away should the player be from the object to be able to interact.
Lenght To Interact What will be the distance at which the player can interact with the object.
Debug Trace Check Object You can see the lines that check the object, it is very useful for testing
Debug Trace to Interact You can define whether you can see the line that will be emitted to interact with the objects, it is also very useful for testing

Now that you know what each thing does, adjust it as shown in the image below:

Captura de tela 2025-01-28 163826.png

Okay, let's continue!


Creating the objects

**To create the objects, I will create children of a base blueprint, which is the base blueprint that is included in the Interact System folders.


The base blueprint is located in the "Base Actor" folder, in the interact system assets folder.

Captura de tela 2025-01-22 173021.png

Before creating the children of the base blueprint, check if in the base blueprint, the Mesh component that comes by default is blocking the trace we created, as shown in the image below:

**All meshes that are part of the base, or children of that base, must block the trace we created.


Captura de tela 2025-01-28 170843.png

Right-click on the base blueprint and create a child of that blueprint.

Captura de tela 2025-01-22 173114.png

And rename it to "BP_Lamp", you can do the same process for the "Key".

Captura de tela 2025-01-22 173153.png


-Creating the lamp

Adjust the lamp and some light, I used the "Spot Light", if you don't want the Start content lamp, you can use any other static mesh.

Captura de tela 2025-01-27 152640.png