Skip to main content

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 Agent Id

Get Brain Name

Gets the character's Inworld Brain name.

Get Brain Name

Get Given Name

Gets the character's Inworld Studio name.

Get Given Name

Get UI Name

Gets the character's Inworld UI name

Get UI Name

Set Brain Name

Sets the character's Inworld Brain name.

Set Brain Name

Set UI Name

Sets the character's Inworld UI name

Set UI Name

Interaction

Cancel Current Interaction

Can be used to interrupt the character's current interaction

Cancel Current Interaction

Get Target Player Camera Location

Gets the location of the targeted player's camera

Get Target Player Camera Location

Is Interacting With Player

Gets if the character is interacting with the player.

Is Interacting With Player

On Player Interaction State Changed

Bind an event to notify when the player interacts with the character.

On Player Interaction State Changed

Send Text Message

Sends a message of type text to the character.

Send Text Message

API Send Text Message

Send Trigger

Sends a trigger to the specified agent.

Send Trigger

API Send Trigger

Send Custom Event

Sends a custom event to the character.

Send Custom Event

API Send Custom Event

Send Audio Message

Sends a message of type audio to the character.

Send Audio Message

API Send Audio Message

Start Audio Session

Starts an audio session with the character.

Start Audio Session

API Start Audio Session

Stop Audio Session

Stops an audio session with the character.

Start Audio Session

API Stop Audio Session

Emotion

Get Emotional Behavior

Gets the Emotion of the character.

Get Emotional Behavior

Get Emotional Strength

Gets the strength of the Emotional Behavior of the character.

Get Emotional Strength

On Emotional Behavior Changed

Bind an event to notify when Emotional Behavior or Strength has changed.

On Emotional Behavior 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

On Utterance Interrupt

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

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

On Silence Interrupt

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

On Trigger

InteractionEnd

The FCharacterMessageInteractionEnd represents the end of the interaction for the character. The event carries no parameters.

On Interaction End

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.

Get Playback

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.

See Playback Types.