From 81358b7f14c04bd695046e786abcee25e27bb5fb Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Mon, 21 Sep 2015 17:01:31 -0700 Subject: [PATCH] wand changes --- examples/toys/bubblewand/wand.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/examples/toys/bubblewand/wand.js b/examples/toys/bubblewand/wand.js index ae9a43eefc..1541985315 100644 --- a/examples/toys/bubblewand/wand.js +++ b/examples/toys/bubblewand/wand.js @@ -40,12 +40,26 @@ var _this; + function interval() { + var lastTime = new Date().getTime() / 1000; + + return function getInterval() { + var newTime = new Date().getTime() / 1000; + var delta = newTime - lastTime; + lastTime = newTime; + return delta; + }; + } + + var checkInterval = interval(); + + var BubbleWand = function() { _this = this; } BubbleWand.prototype = { - timePassed:null, + timePassed: null, currentBubble: null, preload: function(entityID) { this.entityID = entityID; @@ -56,7 +70,7 @@ Script.update.disconnect(this.update); }, update: function(deltaTime) { - this.timePassed=deltaTime; + this.timePassed = deltaTime; var defaultGrabData = { activated: false, avatarId: null @@ -220,7 +234,7 @@ } }, continueNearGrab: function() { - + print('time passed:::' + checkInterval()); if (this.timePassed === null) { this.timePassed = Date.now(); } else {