Advanced Interact System Updated
For this step of the documentation, I will use the Third person 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 do something simple, but necessary for you to understand how this system mode works.
Let's make an actor that when it receives interaction it is destroyed, that's enough, let's go!
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 | Look At Object |
Where Look Object Icon Should Show | Icon On Object |
The component is ready.
Let's move the player's camera a little to the side, go to "CameraBoom" which is in the player, and set the values as in the image below:
Now that the player is configured, let's create the actor.
To create the object, I will use a copy of the actor that is ready to be used, you can create it from scratch, make a copy or make a child of the actor that is already ready.
The path to the object is this:
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 duplicated and named the new actor "BP Destroy Object".
I added a cube and adjusted the scale.
As it is an Object that will be destroyed when it receives interaction, this is the logic.
You can get these interaction and overlap events by clicking on the component and in the details panel at the end you will find, as if it were the "Pressed" of a button in the widget.
And in the object component I only adjusted the location of the widget, as in the image below:
Drag the object into the world, and try to interact with it, mine looked like this.
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 the Look At Object system, the widgets that you should focus on changing something are the widgets that are marked below, they are the ones used when using Look At Object.
If you decide that the icon will be shown on the screen, then the changes must be made in the "WBP_Crosshair" widget.
The dot in the center of the screen is not an image, it is a border that has been changed, please do not touch it, some codes use its reference. As for the hand icon, you can change the image without any problems.
And when the icon is displayed on the object, you can change the image in the "WBP_LookObjectIconOnObject" 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 object that 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 line that does the checking hits this Sphere, it will understand that it is already the object and will say that it can now interact. Yes, you can leave it like that, if it is a small object, but in this case I don't want it to do that.
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”