Last active
April 12, 2019 20:04
-
-
Save prestomation/bfe7920f86449ae8b76e1745a4fa1045 to your computer and use it in GitHub Desktop.
javascript snippet for creating dynamic speech in a Sumerian Host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put the below in a script in the ScriptComponent attached to the host entity | |
//It must be attached to the host entity so that `ctx.entity` below refers to the host | |
//If this script is attached elsewhere, the lip syncing will not work | |
const speech = new sumerian.Speech(); | |
speech.body = "The sentene to be spoken by the host"; | |
speech.type = 'ssml'; | |
// This sets up the entity so the right ssml events fire (We can make the host lip sync and move) | |
speech.updateConfig({ entity: ctx.entity }); | |
const speechComponent = ctx.entity.getComponent('SpeechComponent'); | |
speechComponent.addSpeech(speech); | |
return speech.play().then(() => { | |
//scripts here will run after the speech completes | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment