REFERENCECOMPONENTS
UCISCharacterInteractionComponent
The character's part of the interaction system. It goes on a character, tracks the interaction objects whose components overlap its triggers, chooses the best usable object, and runs the hold and the use when the player presses the use button. Call TryUseObject and TryInterruptObjectUsing from the player's input. The component starts only on the machine that controls the character: the player's machine, or the server for an AI possessed before BeginPlay. Call InitCharacterInteractionComponent for an AI possessed later.
Functions
Replaces the triggers whose overlaps the character tracks with TriggersForOverlap (null entries are skipped). The set of the last call stays in force across a shutdown: every later InitCharacterInteractionComponent binds it again instead of the settings' TriggerComponents. It binds whether or not the character is locally controlled.
- Category
- CIS|CharacterInteractionComponent
Starts a hold on the best usable object: the object that the best-object delegate last reported, while it is still usable, else the best usable object now. Does nothing while the character already holds or uses an object, or when no object is usable. The hold lasts the object's use time (see GetDelayedObjectProgress). Call it on the machine that controls the character; the server checks the use request that the client sends.
- Category
- CIS|CharacterInteractionComponent
Clears the pending hold, and interrupts the running use when the object's Object Interruption Type equals InterruptionType. Returns true when a running use was interrupted. None never interrupts. Call it with InterruptAfterReleaseButton when the use button is released, and with InterruptAfterSecondPressButton when a second press should interrupt. Call it on the machine that controls the character.
- Category
- CIS|CharacterInteractionComponent
True when the character tracks ObjectToCheck and the object's data object reports it usable for this character now: it is in reach, the character faces it, it is usable, nobody else uses it, and it passes its Visible Conditions and Usable Conditions. False for null or for an object that is not tracked.
- Category
- CIS|CharacterInteractionComponent
Number of tracked interaction objects whose data says the character can use them now (as IsCanUseObject reads it); never negative.
- Category
- CIS|CharacterInteractionComponent
True from the moment a completed hold starts its use, just before OnStartUseObjectDelegate runs, until the use ends. A pending hold does not count; see IsHasDelayedObjectData.
- Category
- CIS|CharacterInteractionComponent
The object that the use of this character runs on, or null when none does. The server sets it when it confirms a use. The other players receive it through replication; the player's own machine sets its copy when the hold completes.
- Category
- CIS|CharacterInteractionComponent
The best usable object now: among the objects that the character tracks and can use, the one with the highest total score of the Tests to Determine Object for Use. Null when none is usable. The tracked objects exist on the machine that controls the character.
- Category
- CIS|CharacterInteractionComponent
Progress of the pending hold in [0,1]: 0 without a hold, 1 for a hold with a zero use time.
- Category
- CIS|CharacterInteractionComponent
Number of interaction objects this character keeps data for: every object that has overlapped one of the triggers and was not removed yet (by the periodic cleanup, by the object's actor being destroyed, or by RemoveInteractionObjectData). Includes an entry whose object component was destroyed and that the next cleanup removes.
Starts a use of Data's interaction object by this character: a new UCISUseExecution with the context of the data's current side, the action for the object's state and the next execution id, initialised with Data and started. The active use holds it until the use ends; on the authority, the object's MaxUseDuration above 0 limits the use and ends it as interrupted. The default UCISInteractionDataObject::UseObject calls it. Returns the execution (which may already have ended inside Start), null when Data has no object component or the owner is not a character; while another use runs, it ensures and returns that use's execution.
The execution of the use this character runs (ActiveUse.Execution), null when none runs (cleared when it ends).
Phase of this character's use: Holding while the use button is held for the object's use time (from TryUseObject until the use starts or the hold is cleared), then the phases of the use's execution (Moving, Acting; Ending only inside the end), None without a hold or a use. Pending: a remote client while StartUseExecution sends the use request. IsCharacterUseAnyObject and IsHasDelayedObjectData change at their own points, not with this phase: for example, inside OnStartUseObjectDelegate this is still Holding. On the server and on the clients that show a use of this character, the phase of their own run of that use.
- Category
- CIS|CharacterInteractionComponent
A phase of a use of this character that the server multicast through Object (MulticastUsePhase), on a client. Applied to this machine's own use with the same ExecutionId and object, and to the use this machine shows with that id and object, also when the character has become locally controlled meanwhile; ignored for any other use of a locally controlled character (the user's machine runs its own uses only); otherwise shown: a Moving phase of a newer use starts a simulated execution (no data object), the later phases of that use move it on (UCISUseExecution::ApplyLeaderPhase). A phase of a use whose start this machine did not see is ignored (a late joiner shows nothing of it). Called by UCISInteractionObjectComponent.
Binds the triggers and starts the poll and cleanup timers, once: does nothing while the component is initialised or shuts down, without a character, or when the character is not locally controlled. The triggers are the set of the last InitInteractionTriggers call made by other code than this function, if there was one (its components that still exist), else the settings' TriggerComponents. Called by BeginPlay, and one tick after a controller change that made a player-controlled character locally controlled (HandleCISCharacterControllerChanged); ShutdownCharacterInteractionComponent undoes it, after which it initialises again.
- Category
- CIS|CharacterInteractionComponent
True while a hold is pending: from TryUseObject until the hold completes and its use starts, or until the hold is cleared (a release, another interruption, or the object stops being usable).
- Category
- CIS|CharacterInteractionComponent
Properties
The settings of this character: its view angle, hold time, triggers, tests, cleanup interval and data object class.
- Category
- Settings
In the editor, draws the character's view cone and writes the names of the overlapped objects on the screen. Nothing is drawn in a packaged game.
- Default
- false
- Category
- Settings|Debug
Seconds the pending hold has run. GetDelayedObjectProgress divides it by DelayedUsingTime. Zero without a hold.
- Default
- 0.f
- Category
- CIS|CharacterInteractionComponent
Length, in seconds, of the pending hold: the object's Override Object Use Time when that is on, otherwise the character's Time to Use Object. It keeps the length of the last hold after that hold ends.
- Default
- 1.f
- Category
- CIS|CharacterInteractionComponent
Possible to use object
- Category
- CIS|CharacterInteractionComponent
Events
Runs when a hold starts: the use button has started the hold of the object (TryUseObject). The object is passed. Local to this machine: it runs only on the machine that controls the character.
- Category
- CIS|Delegates
Runs when a hold is removed: after a release or another interruption, when the object stops being usable, and right after a completed hold has started its use. The object of the hold is passed, or null when it is gone. Use it to hide a hold progress bar. Local to this machine: it runs only on the machine that controls the character.
- Category
- CIS|Delegates
Runs when a completed hold starts its use, before the use's own events run. The object is passed. A listener may still clear the hold or make the object unusable; the use then does not start. Local to this machine: it runs only on the machine that controls the character.
- Category
- CIS|Delegates
Runs when a use of this character ends. The object is passed, or null when its component was destroyed during the use. The interruption is not passed here: read bInterrupted from the object's OnUseFinishedDelegate, which runs before this one. Local to this machine: it runs only on the machine that controls the character.
- Category
- CIS|Delegates
Runs when the best object for use changes. The component looks for it every Update Current Use Object Interval seconds. The new best object is passed, or null when none is usable. Local to this machine: it runs only on the machine that controls the character.
- Category
- CIS|Delegates