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 | 250 |
Use Pre Interact? | ✅ |
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.
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".
The "WBP_Base" widget exists because I create these widgets both in the player and in the object, so this widget unites all the others, some things may need to be changed in this widget
Please wait for updates regarding widgets, because yes I am aware that these widgets are not easy to change.
If you decide to add a new component to your object, don't forget to tell how the collision channel should respond, here's an example:
I'm simply going to add a sphere collision to the lamp we created in this session, but I'm not going to change anything regarding the collision.
Maybe you already understand what is going to happen.
Since the collision channel was set to "Block" by default, and I didn't change the presets to tell it how it should respond, then when the player's area collides with this area, the begin overlap event will be called.
To avoid this, there are two ways.
Set the Collision Presets to "Custom" and configure the response for the system's collision channel, in this case I want no response so I set it to "Ignore”
Another way is to go and change the collision presets, Resetting the collision configuration of the Sphere collision, we see that by default it is part of the channel in the image below:
So go to Edit > Project Settings > Collision, click on the Presets arrow and look for the collision preset you want to change, and make the change.
And now if we go back to the object, we will see that by default it will always ignore the area that was created around the player.
Any questions, complaints or suggestions. Join the **Discord** server.
Good luck and much success in your projects!