👉Interactions
Creating interactions with world objects and between players
Last updated
Creating interactions with world objects and between players
Last updated
Due for Removal, please see Docs.
31/10/2024: As interactions does not showcase things only MSquared can do, or functionality we can make more accessible than native Unreal would, we are dropping support for this and removing it from the platform.
This will affect things such as "Focus Cam" and several interactable props. It is unlikely that this system will be something we can provide an alternative for, given it is highly C++ driven.
We encourage users to begin implementing their own system and replacing usages of the M2 Interaction system early to avoid disruption.
Please reach out to your Support Team with any questions.
You can setup Interactions on Actor Blueprints and MMLs, which can then be triggered in-game.
There are two main ways to interact with objects in the world
Walk within the Interaction Range of the object, look at it to Target it, then F to interact
Hover over the object with your mouse, click to walk to the object and automatically interact
Attach this M2_Interactable
Actor 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.
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.
Enabled by default. Disabling this will revert to the unsupported and soon to be deprecated legacy version of this system.
When enabled, any object that has the M2_FocusCameraComponent is able to be made the main focus of a user's screen when interacted with.
Disabling this means that interaction will not be available.
When set to true, an interactable with only a single interaction option will by default bypass the interaction menu upon interaction and will immediately trigger the sole interaction option. This can be overridden for individual objects/options
When set to true, nameplates will be hidden while an interaction is ongoing.
CausesFreezeWhileInteracting
to be ignored if true (as there are no nameplates to freeze).
When set to true, Interactable nameplates will not respond to updates from targeting strategy while an interaction is ongoing, ie. if your targeting strategy selects 'looked at' objects and you:
Look at object A and interact
Look at object B.
IfFreezeWhileInteracting
is false then Object B's nameplate will display, if true then Object A's nameplate will display.
Only takes effect if HideWhileInteracting
is false.
When enabled the Nameplate of the object you are targeting is displayed over the object itself, instead of the default behaviour of displaying the name above the Quickbar.