๐Ÿ‘‰Interaction

Creating interactable in-world objects

Introduction

The new Interaction System allows you to set up Interactions on Actor Blueprints and MMLs, which can then be triggered in-game. This page will give an overview of the system and a guide to setting up your own Interactions.

Using interactables

There are two main ways to interact with interactables in the world

  • You can enter an interactable's Interaction Range and look at it to Target it, then press the Interact key (F) to trigger the interaction

  • You can use the mouse to hover over interactables (they will be highlighted) and click them to start walking to within their range (if not in range already) and interact with them

M2 Interactable Component

Attach this component to an actor to make it interactable. The Display Name will be shown in a nameplate when interacting with the object. You can also specify the Range within which interaction is possible, visualized by the corresponding sphere collider. The Highlightable flag determines if the object will have an outline shown around it when looking at/hovering over it.โ€‹

In the Options map, you can specify the different interactions for your object. When you provide more than one option, interacting with the object will open a list where the desired option can be picked.

Adding interactions

After attaching an Interactable Component, in its Options map we add a generic M2 Interaction Button Option. We can specify a Prompt to show for this option, and optionally an ID as the value's Key to differentiate between multiple interactions.

To trigger functionality on our new interaction, we implement the OnButtonOptionRequested event from the Interactable Component. This event will be triggered whenever the interaction option is clicked (or on interaction, if it is the only option). The Option Id specifies the Name of the option that was triggered, while the Interaction Instigator is the Actor that triggered the option. This could be any Actor, but in the case of a player, it will be their Morpheus Actor.

As an example, we want to launch upward the Character who triggered our interaction. GetRenderTargetFromActor ensures we've got a Render Target (our Character), which we can then use for the remaining logic.

Last updated