diff --git a/msagent.js/src/agent.ts b/msagent.js/src/agent.ts index 3087f9b..f0fb76e 100644 --- a/msagent.js/src/agent.ts +++ b/msagent.js/src/agent.ts @@ -118,6 +118,12 @@ export class Agent { this.animState.play(); } + playAnimationByName(name: String) { + let index = this.data.animInfo.findIndex((n) => n.name == name); + if(index !== -1) + this.playAnimation(index); + } + animationFinished() { this.animState = null; } diff --git a/webapp/src/ts/testbed.ts b/webapp/src/ts/testbed.ts index 1f1246a..19121ef 100644 --- a/webapp/src/ts/testbed.ts +++ b/webapp/src/ts/testbed.ts @@ -14,7 +14,7 @@ input.addEventListener("change", async () => { agent.show(); - agent.playAnimation(0); + agent.playAnimationByName("Show"); console.log("parsed character"); })