From c3b05d6477b2069b4165c616e93b72e23e7a10be Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 19 Oct 2016 15:02:55 -0700 Subject: [PATCH] Added attachment support to crowd-agent --- scripts/developer/tests/performance/crowd-agent.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/developer/tests/performance/crowd-agent.js b/scripts/developer/tests/performance/crowd-agent.js index 2e54e21f45..5586648300 100644 --- a/scripts/developer/tests/performance/crowd-agent.js +++ b/scripts/developer/tests/performance/crowd-agent.js @@ -40,6 +40,8 @@ function onFinishedPlaying() { messageSend({key: 'finishedSound'}); } +var attachment; + var MILLISECONDS_IN_SECOND = 1000; function startAgent(parameters) { // Can also be used to update. print('crowd-agent starting params', JSON.stringify(parameters), JSON.stringify(Agent)); @@ -61,12 +63,22 @@ function startAgent(parameters) { // Can also be used to update. }); } if (parameters.animationData) { - data = parameters.animationData; + var data = parameters.animationData; Avatar.startAnimation(data.url, data.fps || 30, 1.0, (data.loopFlag === undefined) ? true : data.loopFlag, false, data.startFrame || 0, data.endFrame); } + if (parameters.attachment) { + attachment = parameters.attachment; + Avatar.attach(attachment.modelURL, attachment.jointName, attachment.translation, attachment.rotation, attachment.scale, attachment.isSoft); + } else { + attachment = undefined; + } print('crowd-agent avatars started'); } function stopAgent(parameters) { + if (attachment) { + Avatar.detachOne(attachment.modelURL, attachment.jointName); + attachment = undefined; + } Agent.isAvatar = false; print('crowd-agent stopped', JSON.stringify(parameters), JSON.stringify(Agent)); }