The Character Capture & Character Inhibitor Components
A duo of components that can be used to immobilise a Character or limit it's actions
Experimental - Usable, but you must talk to us to understand the implications
Overview
The M2_CharacterCaptureComponent
works in harmony with the M2_CharacterInhibitorComponent
to allow developers to lock out functionality temporarily in a straight-forward way. Currently the component supports disabling a character's movement and ability to jump. This would allow a developer to prevent unintended movement while a character is interacting with different elements in a scene.
This guide will show you how our example content uses these components and will feature a brief explanation of how you might implement this without using the M2 Platform's default Character class.
Integration
To use an M2_CharacterCaptureComponent
, you will need the following setup:
Enable the live config value in Game schema:
Character.InhibitorComponentEnabled
A
Character
inheriting fromJ_CharacterBase
This will give us an instance of
UM2_CharacterInhibitorComponent
and ourJ_CharacterMovementComponent
has preconfigured hooks to block attempts to move or jump if there's a valid Inhibitor on the Character and the Inhbitor is in aCaptured
orQueuedForRelease
state
BP_CharacterCaptureTest
This asset has been provided as an example of how you might use an M2_CharacterCaptureComponent
to prevent a player from moving or jumping, and releasing them in fixed conditions.
In this example you must either select the options in the menu to change state, or moving whilst Captured will queue your release.
Interacting with the object
Capture - When this option is chosen, character will be unable to move until released
Release - Characters in the Captured state will once again be able to move
Queued Release - Character enters a "Release Queued" state, triggering a visual indicator that progresses until time elapses and the Character is Released
Here you'll see that when we choose the "Capture" option, we use the Capture component attached to this example object to Capture the player that interacts with it. We raise a cube on the sphere as a visual indicator of state.
Releasing the Character
Release happens three ways in our example:
Player selects "Release", this releases them immediately
Player has attempted to move or jump, this queues their release
Player selects "Queue Release" from the menu, this releases them after a short wait
Under the hood
We recommend inheriting from J_CharacterBase
as this already has the hooks set up in J_CharacterMovementComponent
for checking against inhibitors when we call RequestDirectMove
or DoJump
. If you don't use our base, you will need to configure these yourself to block attempts to move or jump.
Last updated