Merge pull request #13 from ericrius1/homereset

Water effect for water can created on hold and deleted on release now
This commit is contained in:
James B. Pollack 2016-03-23 16:50:53 -07:00
commit 7934eee368
2 changed files with 18 additions and 15 deletions

View file

@ -37,6 +37,14 @@
},
startHold: function() {
if (_this.waterSpout) {
_this.waterSpoutPosition = Entities.getEntityProperties(_this.waterSpout, "position").position;
_this.waterSpoutRotation = Entities.getEntityProperties(_this.waterSpout, "rotation").rotation;
_this.createWaterEffect();
} else {
print("EBL NO WATER SPOUT FOUND RETURNING");
return;
}
_this.findGrowableEntities();
},
@ -50,6 +58,9 @@
releaseHold: function() {
_this.stopPouring();
Script.setTimeout(function() {
Entities.deleteEntity(_this.waterEffect);
}, 2000);
},
stopPouring: function() {
@ -130,8 +141,6 @@
},
createWaterEffect: function() {
var waterEffectPosition = Vec3.sum(_this.waterSpoutPosition, Vec3.multiply(Quat.getFront(_this.waterSpoutRotation), -0.04));
_this.waterEffect = Entities.addEntity({
@ -157,6 +166,7 @@
},
maxParticles: 20000,
lifespan: 2,
lifetime: 5000, //Doubtful anyone will hold water can longer than this
emitRate: 2000,
emitSpeed: .3,
speedSpread: 0.1,
@ -222,13 +232,7 @@
}
});
if (_this.waterSpout) {
_this.waterSpoutPosition = Entities.getEntityProperties(_this.waterSpout, "position").position;
_this.waterSpoutRotation = Entities.getEntityProperties(_this.waterSpout, "rotation").rotation;
_this.createWaterEffect();
}
}, 3000);
}, 2000);
},

View file

@ -12,14 +12,13 @@
var PLANT_SCRIPT_URL = Script.resolvePath("growingPlantEntityScript.js?v1" + Math.random().toFixed(2));
var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js?v2" + Math.random().toFixed());
Plant = function(spawnPosition, spawnRotation) {
var orientation = Camera.getOrientation();
orientation = Quat.safeEulerAngles(orientation);
orientation.x = 0;
orientation = Quat.fromVec3Degrees(orientation);
var orientation;
if (spawnRotation !== undefined) {
orientation = spawnRotation;
orientation = Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z);
} else {
orientation = Camera.getOrientation();
}
print("EBL ORIENTATION " + JSON.stringify(orientation));
var bowlPosition = spawnPosition;
var BOWL_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Bowl.fbx";
var bowlDimensions = {