From 2cd97bfe78d1254f0521963d8b7bf58a9eeff354 Mon Sep 17 00:00:00 2001 From: Zander Otavka Date: Fri, 22 Jul 2016 15:55:42 -0700 Subject: [PATCH 1/2] Fix squeezeHands.js error on script end --- scripts/system/controllers/squeezeHands.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/squeezeHands.js b/scripts/system/controllers/squeezeHands.js index 9fdb359b25..f549f911c9 100644 --- a/scripts/system/controllers/squeezeHands.js +++ b/scripts/system/controllers/squeezeHands.js @@ -19,6 +19,8 @@ var CONTROLLER_DEAD_SPOT = 0.25; var TRIGGER_SMOOTH_TIMESCALE = 0.1; var OVERLAY_RAMP_RATE = 8.0; +var animStateHandlerID; + function clamp(val, min, max) { return Math.min(Math.max(val, min), max); } @@ -33,8 +35,10 @@ function lerp(a, b, alpha) { function init() { Script.update.connect(update); - MyAvatar.addAnimationStateHandler(animStateHandler, ["leftHandOverlayAlpha", "rightHandOverlayAlpha", - "leftHandGraspAlpha", "rightHandGraspAlpha"]); + animStateHandlerID = MyAvatar.addAnimationStateHandler( + animStateHandler, + ["leftHandOverlayAlpha", "rightHandOverlayAlpha", "leftHandGraspAlpha", "rightHandGraspAlpha"] + ); } function animStateHandler(props) { @@ -72,7 +76,7 @@ function update(dt) { function shutdown() { Script.update.disconnect(update); - MyAvatar.removeAnimationStateHandler(animStateHandler); + MyAvatar.removeAnimationStateHandler(animStateHandlerID); } Script.scriptEnding.connect(shutdown); From 708cce64b662145bf7e5e8c204a72ccbd2d18f68 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Mon, 25 Jul 2016 11:05:55 -0700 Subject: [PATCH 2/2] work with far trigger --- .../DomainContent/Home/whiteboard/swiper.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/swiper.js b/unpublishedScripts/DomainContent/Home/whiteboard/swiper.js index cd19c6eeee..555224e2b6 100644 --- a/unpublishedScripts/DomainContent/Home/whiteboard/swiper.js +++ b/unpublishedScripts/DomainContent/Home/whiteboard/swiper.js @@ -18,11 +18,22 @@ busy: false, preload: function(entityID) { this.entityID = entityID; + Entities.editEntity(entityID, { + userData: JSON.stringify({ + grabbableKey: { + grabbable: false, + wantsTrigger: true + } + }) + }); Script.update.connect(this.update); }, clickReleaseOnEntity: function() { this.createSupplies(); }, + startFarTrigger: function() { + this.createSupplies(); + }, update: function() { if (_this.busy === true) { return; @@ -45,7 +56,6 @@ }, 2000) } }, - createSupplies: function() { var myProperties = Entities.getEntityProperties(this.entityID);