From b6c0b4fd218543a7356a6d4c49ba6aa2a2b81477 Mon Sep 17 00:00:00 2001 From: barnold1953 Date: Wed, 30 Jul 2014 17:39:24 -0700 Subject: [PATCH] Random mood in procedural bot --- examples/bot_procedural.js. | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/bot_procedural.js. b/examples/bot_procedural.js. index 17e54007cc..00c2829924 100644 --- a/examples/bot_procedural.js. +++ b/examples/bot_procedural.js. @@ -1,5 +1,5 @@ // -// proceduralBot.js +// bot_procedural.js // hifi // // Created by Ben Arnold on 7/29/2013 @@ -154,7 +154,18 @@ function addBlendshapeToPose(pose, shapeIndex, val) { pose.blendShapes[index] = {shapeIndex: shapeIndex, val: val }; } //The mood of the avatar, determines face. 0 = happy, 1 = angry, 2 = sad. -var avatarMood = 0; + +//Randomly pick avatar mood. 80% happy, 10% mad 10% sad +var randMood = Math.floor(Math.random() * 11); +var avatarMood; +if (randMood == 0) { + avatarMood = 1; +} else if (randMood == 2) { + avatarMood = 2; +} else { + avatarMood = 0; +} + var currentExpression = -1; //Face pose constructor var happyPoses = [];