Skip to main content

Robot Character Example

Talking Cube

Preface

This page will guide you through the creation of a robot character that is powered by Inworld! This can act as a good first test in creating custom Inworld characters using custom assets within Unreal Engine.

Requirements

This guide will assume that you have already created an Inworld Studio Workspace, and have setup both an Inworld Player, and an Inworld Scene.

To follow along, you will need to add this Content Pack to your project's Content directory.

The provided assets were created in Unreal Engine 5.1, and may not work with newer versions.

Creating the Robot

Creating the Blueprint

Create a new Actor Blueprint by right-clicking within the Unreal Engine Content Browser and selecting Create Basic Asset > Blueprint Class

Robot Create Blueprint

From the resulting Pick Parent Class popup, select Actor.

Robot Parent Class

Name the resulting Blueprint asset BP_Robot.

Robot Blueprint

Adding Robot Assets

Add a Skeletal Mesh by selecing + Add > SkeletalMesh.

Robot Add Skeletal Mesh

Set the Skeletal Mesh Asset on this component to SK_Robot.

Robot Parent Class

Adding Inworld Components

Add an AudioComponent by selecing + Add > Audio, and an InworldCharacterComponent by selecting + Add > Inworld Character.

Robot Add Audio Robot Add Inworld

Edit the AudioComponent's default values. Set the Parent Socket to head so that the audio will emit from the robot character's head.

Edit the InworldCharacterComponent's default values. Set the desired brain name for the Robot, and add an InworldCharacterPlaybackAudio so that the audio data is sent through the Audio Component that was created.

Robot Character Config

Adding Facial Animation

Add two PaperSpriteComponents by selecting + Add > Paper Sprite.

Robot Add Sprites

Edit these PaperSprite's default values. Name one Eyes, and the other Mouth. Set the Parent Socket of each component to head so that the sprite will follow the head as the character's body animates.

For the Eyes, set the Source Sprite to SRP_Robot_Eyes_Idle_01, and set the transform to Location: (1,8.5,0) Rotation: (0,270,0) Scale: (0.003,1,0.003).

Robot Add Eyes

For the Mouth, set the Source Sprite to SPR_Robot_Mouth_Idle_01, and set the transform to Location: (-5,8.5,0) Rotation: (0,270,0) Scale: (0.003,1,0.003).

Robot Add Eyes

Animating Emotion

Create two Variables for the BP_Robot of type Paper Sprite. Name one CurrentEyeEmotionSprite, and the other CurrentMouthEmotionSprite.

Robot Eyes Variable Robot Mouth Variable

Create two Variables for the BP_Robot of type Map, with a key of EInworldCharacterEmotionalBehavior, and value of **Paper Sprite. Name one EmotionsToEyeSprites, and the other **EmotionsToMouthSprites**.

Robot Eyes Map Robot Mouth Map

With these Blueprint Variables setup, it can be utilized in the BP_Robot's Event Graph. Simply bind an Event to the InworldCharacterComponent's OnEmotionalBehaviorChanged. Using the Emotional Behavior provided by the event, map the corresponding Paper Sprite from the maps, cache the values, and call SetSprite on the Eyes and Mouth components.

Robot Emotion Blueprint

Animating Visemes

Create a Variable for the BP_Robot of type Array of Paper Sprite. Name this MouthVisemes.

Robot Viseme Array

With this Blueprint Variable setup, it can be utilized in the BP_Robot's Event Graph. Simply bind an Event to the InworldCharacterComponent's InworldCharacterPlaybackAudio's OnVisemeBlendsUpdated. Since these Visemes are for human lip movement, simply select a random entry in the MouthVisemes array or the CurrentMouthEmotionSprite if the 'STOP' blend is not 0.

Robot Mouth Blueprint

Adding Body Animation

Create a new Animation Blueprint by right-clicking in the Unreal Engine Content Browser and selecting Create Advanced Asset > Animation Blueprint.

Robot Animation Blueprint Create

Name the resulting Blueprint asset ABP_Robot.

Robot Animation Blueprint Asset

Create a Variable for the ABP_Robot of type EInworldEmotionalBehavior. Name this CachedEmotionalBehavior.

Robot Emotional Behavior

With this Animation Blueprint Variable setup, it can be utilized in the ABP_Robot's Event Graph. Simply cast the Owner to BP_Robot, and bind an Event to the Robot's InworldCharacterComponent's OnEmotionalBehaviorChanged to cache the result.

Robot Emotional Behavior Cache

In the ABP_Robot's Animation Graph, create an Animation State Machine.

Robot Create Anim State Machine

Pass the output of the state machine to the Output Pose.

Robot Output Pose

Open the Animation State Machine, and create a graph to change between Neutral, Angry, Happy, and Sad.

Robot Animation State Machine

Setup each state with its respective animation.

Robot Neutral State

For brevity, only the Neutral state will be shown.

For the State to Intro/Outro transitions, simply check if the CachedEmotionalBehavior meets the requirements.

Robot Neutral To Angry Intro

For brevity, only the Neutral to AngryIntro will be shown.

For the Intro/Outro transitions, simply check if there is remaining time on the relevant animation.

Robot Angry Intro To Angry

For brevity, only the AngryIntro to Angry will be shown.