mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-14 09:35:04 +02:00
adding trigger
This commit is contained in:
parent
a5d4ec15ab
commit
f61aea1c9b
3 changed files with 28 additions and 11 deletions
|
@ -29,7 +29,6 @@
|
|||
|
||||
|
||||
water: function() {
|
||||
print("EBL IM BEING WATERED!");
|
||||
_this.cactusDimensions = Vec3.sum(_this.cactusDimensions, {x: 0, y: _this.GROW_RATE, z: 0});
|
||||
|
||||
if (_this.cactusDimensions.y > _this.MAX_CACTUS_Y_DIMENSION) {
|
||||
|
@ -75,7 +74,7 @@
|
|||
|
||||
var flowerUserData = {
|
||||
ProceduralEntity: {
|
||||
shaderUrl: "file:///C:/Users/Eric/hifi/examples/homeContent/plant/flower.fs",
|
||||
shaderUrl: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/shaders/flower.fs",
|
||||
uniforms: {
|
||||
iBloomPct: randFloat(0.4, 0.8),
|
||||
hueTwerking: randFloat(10, 30)
|
||||
|
@ -84,6 +83,7 @@
|
|||
};
|
||||
var flower = Entities.addEntity({
|
||||
type: "Sphere",
|
||||
name: "flower",
|
||||
position: position,
|
||||
dimensions: _this.startingFlowerDimensions,
|
||||
userData: JSON.stringify(flowerUserData)
|
||||
|
@ -104,13 +104,13 @@
|
|||
_this.cactus = Entities.addEntity({
|
||||
type: "Model",
|
||||
modelURL: MODEL_URL,
|
||||
name: "cactus",
|
||||
position: _this.cactusPosition,
|
||||
dimensions: _this.cactusDimensions
|
||||
});
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
print("EBL PRELOAD");
|
||||
this.entityID = entityID;
|
||||
this.props = Entities.getEntityProperties(this.entityID, ["position", "dimensions"]);
|
||||
this.position = this.props.position;
|
||||
|
@ -126,7 +126,6 @@
|
|||
_this.flowers.forEach(function(flower) {
|
||||
Entities.deleteEntity(flower);
|
||||
});
|
||||
print("EBL UNLOAD DONE")
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -30,21 +30,40 @@ function initializePlant() {
|
|||
position: center
|
||||
});
|
||||
|
||||
var HOSE_MODEL_URL = "file:///C:/Users/Eric/Desktop/hose.fbx?v1" + Math.random();
|
||||
var HOSE_SCRIPT_URL = Script.resolvePath("waterHoseEntityScript.js?v1" + Math.random());
|
||||
var HOSE_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/hose.fbx";
|
||||
var HOSE_SCRIPT_URL = Script.resolvePath("waterHoseEntityScript.js?v1" + Math.random());
|
||||
hose = Entities.addEntity({
|
||||
type: "Model",
|
||||
modelURL: HOSE_MODEL_URL,
|
||||
position: Vec3.sum(center, {x: 0.0, y: 1, z: 0}),
|
||||
color: {red: 200, green: 10, blue: 200},
|
||||
position: Vec3.sum(center, {
|
||||
x: 0.0,
|
||||
y: 1,
|
||||
z: 0
|
||||
}),
|
||||
color: {
|
||||
red: 200,
|
||||
green: 10,
|
||||
blue: 200
|
||||
},
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
wantsTrigger: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Script.setTimeout(function() {
|
||||
var potNaturalDimensions = Entities.getEntityProperties(pot, "naturalDimensions").naturalDimensions;
|
||||
Entities.editEntity(pot, {dimensions: potNaturalDimensions, script: PLANT_SCRIPT_URL});
|
||||
Entities.editEntity(pot, {
|
||||
dimensions: potNaturalDimensions,
|
||||
script: PLANT_SCRIPT_URL
|
||||
});
|
||||
|
||||
var hoseNaturalDimensions = Entities.getEntityProperties(hose, "naturalDimensions").naturalDimensions;
|
||||
Entities.editEntity(hose, {dimensions: hoseNaturalDimensions, script: HOSE_SCRIPT_URL});
|
||||
Entities.editEntity(hose, {
|
||||
dimensions: hoseNaturalDimensions,
|
||||
script: HOSE_SCRIPT_URL
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@
|
|||
alphaStart: 0.7,
|
||||
alphaFinish: 0.5,
|
||||
textures: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/raindrop.png",
|
||||
// emitterShouldTrail: true
|
||||
});
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue