diff --git a/examples/toys/bubblewand/createWand.js b/examples/toys/bubblewand/createWand.js index 76681a50d7..9938acb63f 100644 --- a/examples/toys/bubblewand/createWand.js +++ b/examples/toys/bubblewand/createWand.js @@ -30,7 +30,7 @@ var wand = Entities.addEntity({ position: center, gravity: { x: 0, - y: -9.8, + y: 0, z: 0, }, dimensions: { @@ -45,7 +45,8 @@ var wand = Entities.addEntity({ }); function cleanup() { - Entities.deleteEntity(wand); +// the line below this is commented out to make the wand that you create persistent. + Entities.deleteEntity(wand); } diff --git a/examples/toys/bubblewand/wand.js b/examples/toys/bubblewand/wand.js index 064d045f35..ae9a43eefc 100644 --- a/examples/toys/bubblewand/wand.js +++ b/examples/toys/bubblewand/wand.js @@ -45,6 +45,7 @@ } BubbleWand.prototype = { + timePassed:null, currentBubble: null, preload: function(entityID) { this.entityID = entityID; @@ -55,6 +56,7 @@ Script.update.disconnect(this.update); }, update: function(deltaTime) { + this.timePassed=deltaTime; var defaultGrabData = { activated: false, avatarId: null @@ -210,7 +212,37 @@ }); - } + }, + startNearGrab: function() { + print('START NEAR GRAB') + if (_this.currentBubble === null) { + _this.createBubbleAtTipOfWand(); + } + }, + continueNearGrab: function() { + + if (this.timePassed === null) { + this.timePassed = Date.now(); + } else { + var newTime = = Date.now() - this.timePassed; + // this.timePassed = newTime; + } + print('CONTINUE NEAR GRAB::' + this.timePassed); + + + }, + releaseGrab: function() { + //delete the lights and reset state + if (this.hasSpotlight) { + Entities.deleteEntity(this.spotlight); + Entities.deleteEntity(this.glowLight); + this.hasSpotlight = false; + this.glowLight = null; + this.spotlight = null; + this.whichHand = null; + + } + }, }