3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-04-30 09:02:57 +02:00

water effect created on hold

This commit is contained in:
ericrius1 2016-03-23 16:46:38 -07:00
parent 7bbb8167d0
commit 22629bf6c4
2 changed files with 14 additions and 17 deletions
unpublishedScripts/DomainContent/Home/growingPlant

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

@ -127,13 +127,6 @@ Plant = function(spawnPosition, spawnRotation) {
var waterSpoutPosition = Vec3.sum(waterCanPosition, Vec3.multiply(0.2, Quat.getFront(orientation)))
var waterSpoutRotation = Quat.multiply(waterCanRotation, Quat.fromPitchYawRollDegrees(10, 0, 0));
// var waterSpoutRotation = {
// x: waterSpoutRotation.x,
// y: waterSpoutRotation.y,
// z: waterSpoutRotation.z,
// w: waterSpoutRotation.w
// };
print("EBL SET ROTATION")
var waterSpout = Entities.addEntity({
type: "Box",
name: "hifi-water-spout",
@ -150,7 +143,7 @@ Plant = function(spawnPosition, spawnRotation) {
position: waterSpoutPosition,
rotation: waterSpoutRotation,
parentID: waterCan,
// visible: false,
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true