Character Interaction System

Intro

Character Interaction System is a comprehensive, flexible, yet very accessible and easy-to-master system for creating interactions in your game.

With it, you can create various types of interactions, ranging from a simple light switch to complex cases, like a door where different animations should play from different sides depending on the current state of the door and from which side it is being opened.

The plugin is written using C++, but you absolutely don’t need to know the language to work with it.

All necessary functionalities and interfaces for customization have been moved to blueprints.

Also, this system is replicated and ready for integration into your multiplayer projects.

All assets used in the trailer can be found in the example project via the link below.

Main Features:

  • Use C++ or Blueprints to work with system

  • Easy to setup on any actor

  • Highly expandable and customizable system

  • Multiplayer Support

  • Basic widgets and world markers for interactable objects

  • Supports different types of interactions

  • Supports interaction interruptions

Included many different types of interactions in Example Project:

  • Doors

  • Crates

  • Buttons

  • Levers

  • Code Locks

  • Valves

  • And MORE!

Playable Demo: Link

Basic Setup

First of all, enable the display of plugin content in the settings.

Also, to learn how to work with the plugin, I advise looking at the example project and studying the component settings there. Various use case scenarios of the plugin are presented there, which will answer many potential questions.

Step 1

To start working with the plugin, you need to add the CISCharacterInteraction component to your character.

Step 2

The next step is to add a sphere or any other shape to your character. This sphere will be responsible for overlaps and subsequent processing of your interactive objects. Set the collision settings based on the requirements of your project.

Step 3

Next, you need to configure the component added earlier.

Now, let’s consider not all parameters, but only the most necessary ones for the plugin to operate. Other parameters can help make working with the plugin more flexible, and we will consider them in a separate section of the documentation.

InteractionAngle - The necessary angle between the character and the interactive object to begin interaction with it.

TimeToUseObject - the time that must pass after pressing the interaction button to interact with the object.

TriggerComponents - Triggers responsible for overlaps with interactive objects. You are unlikely to need more than one. Choose the component previously added to your actor (Sphere) here.

Step 4

Let's start by clarifying that the actions for interacting with an object are selected based on the current state of the object. For example, if the current state of the door is "closed," the available action for it would be to open the door. In the case of simple interactions without changing the state of the object, these settings can be neglected. The states of the object are described in the form of FGameplayTag.

Let's go through the parameters:

  • AngleDetectionComponent: The component by which the angle between the character and the object will be determined; choose one of the available ones in the actor.

  • OverrideCharacterInteractionAngle: In case you need to use some custom interaction angle for the object, you can override it using this parameter.

  • OverrideObjectUseTime: In case you need to override the button hold time for the object to be used for a specific object, use this parameter.

  • ObjectInterruptionType: Use this setting if there is a need to interrupt the active action in some way.

  • VisibleConditions: Conditions when the object is already somehow visualized for interaction, but it is still impossible to interact with it. Will be considered in detail in a separate section.

  • UsableConditions: Conditions for interacting with the object. Will be considered in detail in a separate section.

  • ObjectPriority: The priority of using the object, for cases when there are several objects nearby available for interaction.

  • OverrideDataObjectClass: Will be considered in detail in a separate section.

  • InitialObjectState: The initial state of the object at the moment of play begin.

  • Usable: Whether this object can be used. Can be changed at runtime.

InteractionSides

Each interactive object can have one or several sides for interaction with different actions for each side.

Taking a door as an example - it has 2 sides for interaction - front and back, with specific settings of available angles. Interaction from one side will open the door towards oneself, and from the other side, away from oneself.

In a simpler case, like a button, it has one side for interaction with a 360-degree radius because it doesn’t matter which side we press it from.

  • InteractionAngle Min/Max: Available angles for interacting with the side.

  • AngleSide: A parameter that inverts the angle.

  • InteractionObjectSideMoveHandler: If you need the character to first approach the object before or during interaction, you will need to create and implement an object of this class. See detailed descriptions on working with it in a separate section; we will not consider it for the basic implementation. You can also see the implementation in the ExampleProject.

  • ActionExecutionType: Setting the type of interaction with the object, either parallel to the MoveHandler's work or after the character has stood at the necessary point.

  • InteractionObjectSideActions: A list of available actions for the side, depending on the current state of the object.

    • RequiredStateTag: The current state of the object necessary for activating this action.

    • InteractionObjectAction: The action for the object. In the example with the closed door, the action will be "open the door," i.e., play animation on the character and door, after which change the door state to "Open."

But let’s consider a simpler version - switching the light of a bulb.

Lightbulb Implementation Example

First and foremost, add the WBP_InteractionPanel widget to your HUD.

In your character, within the CISCharacterInteraction component, select DataObject as shown in the screenshot below.

Also, add the respective logic to the character for your interaction button.

Create a new actor BP_LightSwitcher. Let it inherit from BP_CISBaseInteractableActor.

First things first, add a PointLight component to your actor.

Next, create two gameplay tags: Interaction.Switcher.On and Interaction.Switcher.Off.

Configure two actions for the previously created side; one action will be when the lightbulb is off, and another when it is on.

Also, set up the InitialObjectState, so the lightbulb is initially off.

Subscribe to the object state change event in your lightbulb actor.

Implement switch logic for the states when the lightbulb is on and off.

Change the visibility of your lightbulb depending on the state.

In this case, we won't implement any particular logic in the action. It's only necessary for the internal system's operation to toggle object states. A detailed description of more complex cases will be in a separate section.

Add the created action for both states of your object.

Configure the new state after completing the action so that for the lightbulb's On state, it changes to Off and vice versa.

Done! Here is the result.

Last updated