mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
stable
This commit is contained in:
parent
4c3e3538e8
commit
11047f676b
2 changed files with 51 additions and 5 deletions
|
@ -24,9 +24,51 @@
|
||||||
GrowingPlant.prototype = {
|
GrowingPlant.prototype = {
|
||||||
|
|
||||||
createFlowers: function() {
|
createFlowers: function() {
|
||||||
for(var i = 0; i < 3; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
_this.createFlower();
|
_this.createFlower();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createCactus: function() {
|
||||||
|
var MODEL_URL = "file:///C:/Users/Eric/Desktop/cactus.fbx?v1" + Math.random();
|
||||||
|
var dimensions = {
|
||||||
|
x: 0.09,
|
||||||
|
y: 0.01,
|
||||||
|
z: 0.09
|
||||||
|
};
|
||||||
|
_this.cactus = Entities.addEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: MODEL_URL,
|
||||||
|
position: _this.position,
|
||||||
|
dimensions: dimensions
|
||||||
|
});
|
||||||
|
|
||||||
|
var curProps = {
|
||||||
|
yDimension: 0.01,
|
||||||
|
yPosition: _this.position.y
|
||||||
|
};
|
||||||
|
|
||||||
|
var endProps = {
|
||||||
|
yDimension: 0.8,
|
||||||
|
yPosition: _this.position.y + 0.4
|
||||||
|
};
|
||||||
|
|
||||||
|
var growTween = new TWEEN.Tween(curProps).
|
||||||
|
to(endProps, 2000).
|
||||||
|
onUpdate(function() {
|
||||||
|
Entities.editEntity(_this.cactus, {
|
||||||
|
dimensions: {
|
||||||
|
x: dimensions.x,
|
||||||
|
y: curProps.yDimension,
|
||||||
|
z: dimensions.z
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
x: _this.position.x,
|
||||||
|
y: curProps.yPosition,
|
||||||
|
z: _this.position.z
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
},
|
},
|
||||||
|
|
||||||
createFlower: function() {
|
createFlower: function() {
|
||||||
|
@ -39,7 +81,7 @@
|
||||||
ProceduralEntity: {
|
ProceduralEntity: {
|
||||||
shaderUrl: "file:///C:/Users/Eric/hifi/examples/homeContent/plant/flower.fs",
|
shaderUrl: "file:///C:/Users/Eric/hifi/examples/homeContent/plant/flower.fs",
|
||||||
uniforms: {
|
uniforms: {
|
||||||
iBloomPct: 0.0
|
iBloomPct: 0.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -64,7 +106,7 @@
|
||||||
var curProps = {
|
var curProps = {
|
||||||
yDimension: startingFlowerDimensions.y,
|
yDimension: startingFlowerDimensions.y,
|
||||||
yPosition: startingFlowerPosition.y,
|
yPosition: startingFlowerPosition.y,
|
||||||
bloomPct: flowerUserData.ProceduralEntity.uniforms.iBloomPct
|
bloomPct: flowerUserData.ProceduralEntity.uniforms.iBloomPct
|
||||||
};
|
};
|
||||||
var newYDimension = curProps.yDimension + 1;
|
var newYDimension = curProps.yDimension + 1;
|
||||||
var endProps = {
|
var endProps = {
|
||||||
|
@ -101,7 +143,9 @@
|
||||||
this.props = Entities.getEntityProperties(this.entityID, ["position", "dimensions"]);
|
this.props = Entities.getEntityProperties(this.entityID, ["position", "dimensions"]);
|
||||||
this.position = this.props.position;
|
this.position = this.props.position;
|
||||||
this.dimensions = this.props.dimensions;
|
this.dimensions = this.props.dimensions;
|
||||||
|
this.createCactus();
|
||||||
this.createFlowers();
|
this.createFlowers();
|
||||||
|
// this.createFlower();
|
||||||
Script.update.connect(_this.update);
|
Script.update.connect(_this.update);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -111,6 +155,7 @@
|
||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
Script.update.disconnect(_this.update);
|
Script.update.disconnect(_this.update);
|
||||||
|
Entities.deleteEntity(_this.cactus);
|
||||||
_this.flowers.forEach(function(flower) {
|
_this.flowers.forEach(function(flower) {
|
||||||
Entities.deleteEntity(flower);
|
Entities.deleteEntity(flower);
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,6 +32,7 @@ function initializePlant() {
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
var naturalDimensions = Entities.getEntityProperties(pot, "naturalDimensions").naturalDimensions;
|
var naturalDimensions = Entities.getEntityProperties(pot, "naturalDimensions").naturalDimensions;
|
||||||
Entities.editEntity(pot, {dimensions: naturalDimensions, script: SCRIPT_URL});
|
Entities.editEntity(pot, {dimensions: naturalDimensions, script: SCRIPT_URL});
|
||||||
|
// Entities.editEntity(pot, {dimensions: naturalDimensions});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue