mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 21:26:25 +02:00
Merge branch 'bubblewand_hotfix_2' of https://github.com/imgntn/hifi into bubblewand_hotfix_2
This commit is contained in:
commit
c2d5483da6
2 changed files with 33 additions and 14 deletions
|
@ -12,7 +12,7 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
(function() {
|
(function() { << << << < HEAD
|
||||||
Script.include("../../utilities.js");
|
Script.include("../../utilities.js");
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
|
@ -41,20 +41,34 @@
|
||||||
if (tmpProperties.position.x !== 0 && tmpProperties.position.y !== 0 && tmpProperties.position.z !== 0) {
|
if (tmpProperties.position.x !== 0 && tmpProperties.position.y !== 0 && tmpProperties.position.z !== 0) {
|
||||||
properties = tmpProperties;
|
properties = tmpProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.unload = function(entityID) {
|
this.unload = function(entityID) {
|
||||||
Script.update.disconnect(this.internalUpdate);
|
Script.update.disconnect(this.internalUpdate);
|
||||||
var position = properties.position;
|
var position = properties.position;
|
||||||
_this.endOfBubble(position);
|
_t.endOfBubble(position);
|
||||||
|
// print('UNLOAD PROPS' + JSON.stringify(position));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.endOfBubble = function(position) {
|
this.endOfBubble = function(position) {
|
||||||
|
|
||||||
this.createBurstParticles(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) {
|
this.createBurstParticles = function(position) {
|
||||||
|
var _t = this;
|
||||||
//get the current position of the bubble
|
//get the current position of the bubble
|
||||||
var position = properties.position;
|
var position = properties.position;
|
||||||
//var orientation = properties.orientation;
|
//var orientation = properties.orientation;
|
||||||
|
|
|
@ -14,27 +14,32 @@
|
||||||
Script.include("../../utilities.js");
|
Script.include("../../utilities.js");
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
|
|
||||||
var WAND_MODEL = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/models/wand/wand.fbx';
|
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_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));
|
var WAND_SCRIPT_URL = Script.resolvePath("wand.js?"+randInt(0,4000));
|
||||||
//create the wand in front of the avatar
|
//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(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||||
|
|
||||||
|
|
||||||
var wand = Entities.addEntity({
|
var wand = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: WAND_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() {
|
function cleanup() {
|
||||||
Entities.deleteEntity(wand);
|
Entities.deleteEntity(wand);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue