Unreal Inworld Character
The UInworldCharacterComponent implements Inworld::ICharacterComponent and is the default messaging component for an Inworld character. It responsible for getting messages, queueing and passing it to the Playbacks - subcomponents that can handle the messages in different ways.
namespace Inworld
{
class ICharacterComponent
{
public:
virtual void Possess(const Inworld::AgentInfo& AgentInfo) = 0;
virtual void Unpossess() = 0;
virtual const FString& GetAgentId() const = 0;
virtual const FString& GetGivenName() const = 0;
virtual const FString& GetBrainName() const = 0;
virtual void HandlePacket(std::shared_ptr<FInworldPacket> Packet) = 0;
virtual AActor* GetComponentOwner() const = 0;
virtual IPlayerComponent* GetTargetPlayer() = 0;
};
}
Agent Info
Get Agent Id
Gets the character's Inworld Agent Id.
Get Brain Name
Gets the character's Inworld Brain name.
Get Given Name
Gets the character's Inworld Studio name.
Get UI Name
Gets the character's Inworld UI name.
Set Brain Name
Sets the character's Inworld Brain name.
Set UI Name
Sets the character's Inworld UI name.
Interaction
Interrupt
Can be used to interrupt the character's current interaction.
Get Target Player Camera Location
Gets the location of the targeted player's camera.
Is Interacting With Player
Gets if the character is interacting with the player.
On Player Interaction State Changed
Bind an event to notify when the player interacts with the character.
Send Text Message
Sends a message of type text to the character.
Send Trigger
Sends a trigger to the specified agent.
Send Audio Message
Sends a message of type audio to the character.
Start Audio Session
Starts an audio session with the character.
Stop Audio Session
Stops an audio session with the character.
Emotion
Get Emotional Behavior
Gets the Emotion of the character.
Get Emotional Strength
Gets the strength of the Emotional Behavior of the character.
On Emotional Behavior Changed
Bind an event to notify when Emotional Behavior or Strength has changed.
Character Messages
All character messages are of type FCharacterMessage. These messages are all associated with an Utterance and and Interaction.
FString UtteranceId; // Id of the associated Utterance for this message.
FString InteractionId; // Id of the associated Interaction for this message.
Utterance
The FCharacterMessageUtterance represents a character utterance. This provides the text that the character says, along with voice audio data and viseme data for lipsync.
FString Text; // Text that the character utters.
TArray<FCharacterUtteranceVisemeInfo> VisemeInfos; // The viseme data for the utterance.
FString Code; // The encoding of the viseme.
float Timestamp; // When the viseme should be active.
On Utterance
On Utterance Interrupt
PlayerTalk
The FCharacterMessagePlayerTalk represents player speech heard by the character. This provides the text that the player has said.
FString Text; // Text that the player has told the character.
bool bTextFinal; // True if the text for this message has been finalized.
On Player Talk
Silence
The FCharacterMessageSilence represents a character silence. This provides the duration of how long the character is silent.
float Duration; // Time (seconds) of the silence.
On Silence
On Silence Interrupt
Trigger
The FCharacterMessageTrigger represents a triggered event for the character. This provides the name, or id, of the triggered event.
FString Name; // Name (or id) of the trigger.
On Trigger
InteractionEnd
The FCharacterMessageInteractionEnd represents the end of the interaction for the character. The event carries no parameters.
On Interaction End
Character Playback
InworldCharacterPlaybackComponent are useful for reusing shared logic for handling inworld events for various Inworld Characters. InworldCharacterPlaybacks can be mixed, matched, customized, and extended to suit any use case.
Get Playback
Gets the playback component by class.
Playback Types
The types of playback to be created by the Inworld Character Component can be configured in the PlaybackTypes array. These components are created before BeginPlay is called.