From 8a7798fcd759eef45cebf18e1a44138145f4fbc9 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 17 Sep 2015 22:00:44 -0700 Subject: [PATCH] disable bubble particle burst until i know the right for an entity to watch and see if it is deleted. --- examples/toys/bubblewand/bubble.js | 25 ++++++++++++++----------- examples/toys/bubblewand/createWand.js | 5 +++-- examples/toys/bubblewand/wand.js | 19 +++++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/examples/toys/bubblewand/bubble.js b/examples/toys/bubblewand/bubble.js index 2904ca938f..69764c0c97 100644 --- a/examples/toys/bubblewand/bubble.js +++ b/examples/toys/bubblewand/bubble.js @@ -16,7 +16,6 @@ var BUBBLE_PARTICLE_TEXTURE = "http://hifi-public.s3.amazonaws.com/james/bubblewand/textures/bubble_particle.png" - BUBBLE_PARTICLE_COLOR = { red: 0, green: 40, @@ -46,7 +45,7 @@ Script.update.disconnect(this.update); //TODO: Unload doesn't seem like the right place to do this. We really want to know that our lifetime is over. - _this.createBurstParticles(); + // _this.createBurstParticles(); }; @@ -70,12 +69,16 @@ animationSettings: animationSettings, animationIsPlaying: true, position: position, - lifetime: 0.2, - dimensions: dimensions, + lifetime: 0.1, + dimensions: { + x: 10, + y: 10, + z: 10 + }, emitVelocity: { - x: 0.25, - y: 0.25, - z: 0.25 + x: 0.35, + y: 0.35, + z: 0.35 }, velocitySpread: { x: 0.45, @@ -87,12 +90,12 @@ y: -0.1, z: 0 }, - alphaStart: 1.0, + alphaStart: 0.5, alpha: 0.5, - alphaFinish: 0.0, + alphaFinish: 0, textures: BUBBLE_PARTICLE_TEXTURE, - color: BUBBLE_PARTICLE_COLOR, - lifespan: 0.2, + // color: BUBBLE_PARTICLE_COLOR, + lifespan: 0.1, visible: true, locked: false }); diff --git a/examples/toys/bubblewand/createWand.js b/examples/toys/bubblewand/createWand.js index 51ac9738f1..a54e438e5d 100644 --- a/examples/toys/bubblewand/createWand.js +++ b/examples/toys/bubblewand/createWand.js @@ -19,7 +19,7 @@ var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wa var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/collisionHull.obj'; var WAND_SCRIPT_URL = Script.resolvePath("wand.js"); //create the wand in front of the avatar -var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation()))); +var center = Vec3.sum(Vec3.sum(MyAvatar.position, {x: 0, y: 0.5, z: 0}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation()))); var tablePosition = { x:546.48, @@ -34,7 +34,8 @@ var wand = Entities.addEntity({ position: IN_TOYBOX? tablePosition: center, gravity: { x: 0, - y: -9.8, + y:0, + // y: -9.8, z: 0, }, dimensions: { diff --git a/examples/toys/bubblewand/wand.js b/examples/toys/bubblewand/wand.js index 38fbf161b8..e0495f5f40 100644 --- a/examples/toys/bubblewand/wand.js +++ b/examples/toys/bubblewand/wand.js @@ -7,7 +7,6 @@ // // Makes bubbles when you wave the object around. // -// // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -17,7 +16,7 @@ Script.include("../../libraries/utils.js"); var BUBBLE_MODEL = "http://hifi-public.s3.amazonaws.com/james/bubblewand/models/bubble/bubble.fbx"; - var BUBBLE_SCRIPT = Script.resolvePath('bubble.js'); + var BUBBLE_SCRIPT = Script.resolvePath('bubble.js?'+randInt(0,10000)); var BUBBLE_INITIAL_DIMENSIONS = { x: 0.01, @@ -39,7 +38,6 @@ var VELOCITY_STRENGTH_MULTIPLIER = 100; var VELOCITY_THRESHOLD = 1; - var _this; var BubbleWand = function() { @@ -69,10 +67,11 @@ // remember we're being grabbed so we can detect being released _this.beingGrabbed = true; - + //the first time we want to make a bubble if (_this.currentBubble === null) { - _this.spawnBubble(); + _this.createBubbleAtTipOfWand(); } + var properties = Entities.getEntityProperties(_this.entityID); _this.growBubbleWithWandVelocity(properties); @@ -93,6 +92,7 @@ //remove the current bubble when the wand is released Entities.deleteEntity(_this.currentBubble); + _this.currentBubble=null return } @@ -110,8 +110,8 @@ }, randomizeBubbleGravity: function() { - var randomNumber = randInt(0, 3) - var gravity: { + var randomNumber = randInt(0, 3); + var gravity= { x: 0, y: -randomNumber / 10, z: 0 @@ -137,7 +137,6 @@ // velocityStrength = VELOCITY_STRENGTH_MAX // } - //store the last position of the wand for velocity calculations this.lastPosition = wandPosition; @@ -162,7 +161,7 @@ }); //release the bubble -- when we create a new bubble, it will carry on and this update loop will affect the new bubble - this.spawnBubble(); + this.createBubbleAtTipOfWand(); return } else { @@ -188,7 +187,7 @@ dimensions: dimensions }); }, - spawnBubble: function() { + createBubbleAtTipOfWand: function() { //create a new bubble at the tip of the wand var properties = Entities.getEntityProperties(this.entityID);