How-To: Make an Actor Interactable
Goal: make any actor expose interaction options (Pick Up, Open, Talk...) by implementing ICrimsonInteractableTarget - the contract the CrimsonInteraction scanner reads to drive prompts and abilities.
1. Understand the option
Each interaction is an FCrimsonInteractionOption. You fill in the display Text/SubText, choose how it fires (InputType = Instant or Hold, with InputHoldDuration), and pick the gameplay path: grant an ability to the interactor (InteractionAbilityToGrant), activate an ability on the target's own ASC (TargetAbilitySystem + handle), or run a player-side action ability (InteractionActionAbility).
2. Implement the interface
Add ICrimsonInteractableTarget to your actor and override the gather method. In C++ override GatherInteractionOptions and use the FCrimsonInteractionOptionBuilder (it stamps each option's target scope for you). In Blueprint override the K2 Gather Interaction Options event and append to the output array.
Images/CrimsonCommon/howto-interactable-implement.png3. (Optional) React and arbitrate
Override the lifecycle callbacks for feedback - OnInteractableHovered / OnInteractableUnhovered (highlight on/off) and NotifyInteractionSuccess (a hold/channel completed). In C++ you can also override CustomizeInteractionEventData to attach context to the gameplay event before the ability fires. To pick a winner when several options are offered, implement ICrimsonInteractionInstigator::ChooseBestInteractionOption on the instigator (default picks the first available).
See also
- Concept: Decoupling Patterns - why the contract lives in CrimsonCommon
- API Reference -
FCrimsonInteractionOption,FCrimsonInteractionQuery, interaction interfaces