Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdsherbert/unreal-engine-interaction-system
Simple implementation of an Interaction System for Unreal Engine. Utilises two components that communicate with each other through an interface.
https://github.com/jdsherbert/unreal-engine-interaction-system
cpp unreal unreal-engine unreal-engine-4 unreal-engine-5 unrealengine
Last synced: about 1 month ago
JSON representation
Simple implementation of an Interaction System for Unreal Engine. Utilises two components that communicate with each other through an interface.
- Host: GitHub
- URL: https://github.com/jdsherbert/unreal-engine-interaction-system
- Owner: JDSherbert
- License: mit
- Created: 2024-01-05T16:17:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-09T00:09:24.000Z (about 1 year ago)
- Last Synced: 2024-11-10T15:54:12.521Z (3 months ago)
- Topics: cpp, unreal, unreal-engine, unreal-engine-4, unreal-engine-5, unrealengine
- Language: C++
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![image](https://github.com/JDSherbert/Unreal-Engine-Interaction-System/assets/43964243/1f3c86cb-4b3e-4d19-a609-3716d9c0d247)
# Unreal Engine Interaction System
-----------------------------------------------------------------------
-----------------------------------------------------------------------
## Overview
This interaction system provides a simple and modular solution for handling interactions between an interactor (InteractorComponent) and interactable actors (InteractableComponent) in Unreal Engine. The system facilitates communication between these components through a defined interface, allowing you to easily implement and customize interactions within your projects!
Events are also exposed, so you can have unique per object outcomes if you like. It works by raycasting to the hitbox of the actor, and generally works best in a 1st person setup.### Components
#### Interactor
The Interactor component is responsible for initiating interactions with interactable objects. It is typically attached to the player character, or any other actor that needs interaction capabilities.##### Usage:
- Attach to Character: Add the Interactor component to your player character or desired actor.
- Input Action: Configure an input action for interaction (e.g., "Interact"). Bind this action in your player controller or wherever input handling is managed.#### Interactable
The Interactable component represents objects in the world that can be interacted with. It responds to interaction requests from Interactors.##### Usage:
- Attach to Actors: Add the Interactable component to any actor you want to make interactable.
- Implement Interface: Make sure the actor implements the IInteractableInterface interface. This interface defines the methods needed for interaction.
- Interaction Interface (IInteractableInterface)
- The interface defines the communication contract between Interactors and Interactables. It includes methods like OnInteract that need to be implemented by Interactable actors.## Implementation Step
### Attach Components
Attach the Interactor component to your player character or actor that will perform interactions.
Attach the Interactable component to any actor you want to make interactable.### Input Action
As we are using the enhanced input system, define an input action for interaction (e.g., "Interact").
Assign the InputAction in the component via the blueprint inspector, or you can use constructor helpers in the code.### UUserWidgets
Create UUserWidgets (UI) for any interactive feedback you want to provide to the player during interactions.
These widgets are triggered by the Interactable actors during interaction events.
You'll need to make an "E To Interact" and "Cannot Interact" widget. Assign these in the blueprint too.#### Implement Interaction
As we are using events, you can add your own logic in blueprint (or code!) as required.-----------------------------------------------------------------------