Simple Talking Cube

A minimal from scratch example to get you familiar with the plugin main components.

  1. Create a new first person project.

  2. Enable the Convai plugin and add the API key as mentioned here.

  3. Open the created blueprint then search for and add the Convai Chatbot component in the components list. Note: if you do not find the component then ensure that you have properly installed and enabled the plugin by following the Installation guide.

  4. Select the created component and on the details panel, find the Character ID field and paste your character ID which you can get by creating a new character or using an existing one on the Convai Playground.

  5. Add a box component so that you can see the blueprint when placed in the scene.

  6. Place the blueprint in the scene.

  7. Open the player blueprint which by default in First Person/Blueprints/BP_FirstPersonCharacter for the first person template.

  8. Search and add the Convai Player component in the components list.

  9. Add the following blueprint schematic to allow the player to talk to the AI character via the V key:

    1. Add a keyboard key event to be used as a push to talk button (i.e. the `V` key in this example).

    2. Use Convai Get Looked At Character to get the chatbot component of the character that is currently viewed by the player.

    3. Set Radius to a reasonable distance or zero if you want the player to be talk the character over an infinite distance.

    4. Set Plane View to true to only consider the plane axis (X & Y) and ignore the height axis (Z), this is made to prevent having to look directly at the pivot of the character, instead only looking in the direction of the character is sufficent.

    5. Use the Start Talking node from the Convai Player component initiates the talking session with the character, ensure you have enabled Voice Response to get the character to respond vocally.

    6. On the Released event, use the Finish Talking node on the Convai Player component to let the AI character know that we have finished talking and are now waiting for a response.

  10. Hit play, approach the AI character and push T to talk through the microphone, the character should then respond after releasing the T key.

If the character does not respond then make sure your microphone is set properly as the default microphone in the OS settings.

Sending Text instead of Voice

Use the following Send Text node instead if you want to text chat with the character instead of voice.

Note, over here we use a hard coded string as input to the character, you will need to create the required UI to get the text input from the user and send it to the AI character.

Last updated