Merge branch 'bubblewand_hotfix_2' of https://github.com/imgntn/hifi into bubblewand_hotfix_2

This commit is contained in:
James B. Pollack 2015-09-16 16:32:23 -07:00
commit c2d5483da6
2 changed files with 33 additions and 14 deletions

View file

@ -12,7 +12,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
(function() {
(function() { << << << < HEAD
Script.include("../../utilities.js");
Script.include("../../libraries/utils.js");
@ -41,20 +41,34 @@
if (tmpProperties.position.x !== 0 && tmpProperties.position.y !== 0 && tmpProperties.position.z !== 0) {
properties = tmpProperties;
}
};
this.unload = function(entityID) {
Script.update.disconnect(this.internalUpdate);
var position = properties.position;
_this.endOfBubble(position);
_t.endOfBubble(position);
// print('UNLOAD PROPS' + JSON.stringify(position));
};
this.endOfBubble = function(position) {
this.createBurstParticles(position);
};
this.burstBubbleSound(position);
}
this.burstBubbleSound = function(position) {
var audioOptions = {
volume: 0.5,
position: position
}
Audio.playSound(POP_SOUNDS[randInt(0, 4)], audioOptions);
}
this.createBurstParticles = function(position) {
var _t = this;
//get the current position of the bubble
var position = properties.position;
//var orientation = properties.orientation;

View file

@ -14,27 +14,32 @@
Script.include("../../utilities.js");
Script.include("../../libraries/utils.js");
var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx';
var WAND_COLLISION_SHAPE = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/collisionHull.obj';
var WAND_SCRIPT_URL = Script.resolvePath("wand.js?"+randInt(0,4000));
//create the wand in front of the avatar
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
var wand = Entities.addEntity({
type: "Model",
modelURL: WAND_MODEL,
position: center,
dimensions: {
x: 0.05,
y: 0.5,
z: 0.05
},
//must be enabled to be grabbable in the physics engine
collisionsWillMove: true,
compoundShapeURL: WAND_COLLISION_SHAPE,
script: WAND_SCRIPT_URL
});
var wand = Entities.addEntity({
type: "Model",
modelURL: wandModel,
position: center,
dimensions: {
x: 0.05,
y: 0.5,
z: 0.05
},
//must be enabled to be grabbable in the physics engine
collisionsWillMove: true,
compoundShapeURL: WAND_COLLISION_SHAPE,
script: WAND_SCRIPT_URL
});
function cleanup() {
Entities.deleteEntity(wand);
}