FEATURES
Different Interaction Types: Press, Hold & Smash
Highlighting Items
Easy Integration
FEATURES
Different Interaction Types: Press, Hold & Smash
Highlighting Items
Easy Integration
All you need to do to use the Interaction Component is add it to your player as a component. Search for BP_InteractionComponent and click on it.
Click on the cube with the plus sign in your editor, search for Post Process Volume, and place it in your world. You don't need to adjust the size or position according to the size of your world.
Select the Post Process Volume and search for “Infinite Extend (Unbound)” and set it to true. Then search for “Post Process Material,” press the plus sign, and add “MI_PP_InteractionHighlight.” This will enable the highlight system if you want to use it.
How to make your own item interactable?
Open the Actor Blueprint that you want to make interactive, go to Class Settings for the Actor, and add “C_InteractableInterface” under Implemented Interfaces. This will add several functions to your function page that you can edit and use for your own system.
On the left side, under Interfaces -> Interaction, open GetInteractionConfig, right-click on the return of the function, and create a variable from it to edit the interaction. Now, after compiling, you can set the variable to the type of interaction you want to use for the item: Press, Hold, and Smash. You can then edit the length of the hold or the frequency of the smashing.
On the left side, you will find the “Interact” function. You can select it and add it to your code to collect or destroy an item, for example. As input, you will receive an actor reference from the owner of the component, allowing you to do even more.
If an interaction is not possible, it may be because the return node for the “CanInteract” function is set to false. Set it to true if you want to make the item collectible right after the game starts. This is designed for cases where the item cannot be collected yet if it is found too early, etc.
If you want your item to have an outline around the mesh when the player looks at it, add the “C_HighlightComponent” component to the actor. This gives the actor the highlight material that you added to the post-process material at the beginning, and the player can see more clearly which item is currently interactive.
If you have the component in a general actor with many children, but don't want all children to have an outline (for example, if you have hidden items in your game), you can manually disable the outline with “EnableHighlight” despite the component, and you can still customize the stencil.
Inventory Integration
Here you will find step-by-step instructions on how to add the inventory system to your interaction system in just a few steps. Use the tutorial provided or the instructions with text and images.