Advanced Interact System Updated
For this documentation, I will be using the third person project template
If you have not followed the steps on the first page of the documentation, you must follow the steps to continue with the system configuration.
We will focus on making a light that turns on and off when we interact with the lamp, this lamp is included in the "StartContent" folder that you can include in your project, but it does not necessarily need to have this lamp, it can just be a light that will turn on and off, the focus is to understand this side of the interaction system.
In your player's blueprint, click on the component and you will see in the details panel, several variables that can be adjusted.
I am leaving below a table showing what was changed and where it was changed to, I only changed what is in the table, what is not in the table, you can leave the same as it is.
Variable name | What to adjust |
---|---|
Interact Mode | Area Interact |
Area Collision Type | Sphere |
Sphere Radius | 120 |
Use Pre Interact Area? | ✅ |
If Pre Interact, What Distance from the Object to Allow Interaction? | 80 |
Hidden Area In Game | ❌ |
Yes, just that.
I'm going to use a copy of the actor that's ready to be used to create the lamp that we're going to interact with.
And I will name this copy "BP_LightAreaInteract”
If you want to create an actor from scratch, don't forget to add the "CreateWidgetOnObject" event that comes from the component, in the begin play of the actor object.
I replaced the Mesh with the lamp and added a light point
I did this logic in the image below, by default the boolean is true
And I adjusted the object variables like this:
Okay, now we have everything set up for basic interaction, drag your lamp into the world and test it out.
To activate the Hold button to interact system, let's go back to the player.
Click on the component and look for the Hold button category. I adjusted mine in the same way as the image below:
Now just test and see how everything is going.
To use the Outline, go to your map's global post process and search for "Material”
Click to add a material
The material that will be added is the one in the image below:
Now you need to activate the system in the component that was placed in the player
I set true to both booleans
Now take the test
To change the outline behavior, open the material instance that was placed in the post process.
You can preview the changes without having to re-test. Drag a static mesh into the world, go to the details panel, search for "custom depth," and activate it, as shown in the image below:
See that the line was shown in the object, now just make the changes to the material instance and see what the line will look like during the game.
Now let's talk about widgets.
The Widgets are not very user-friendly, it is difficult to configure them, I am looking for a simpler and easier way to change things in the widgets.
I will show you where you will be able to change the images
Using Area Interact, the Widgets that are used for system mode are those in the image below, anything you want to change must be in these two Widgets
If you want to change the icons that appear, you can change them inside the "WBP_ImageKeyAndPreInteract" widget.
And if you want to change the hold button icon, you can change it in "WBP_HoldButtonUIProgress".