cactus getting watered

This commit is contained in:
ericrius1 2016-02-15 15:26:58 -08:00
parent 678caef9c6
commit 969ae2e07b

View file

@ -28,6 +28,10 @@
water: function() { water: function() {
print("EBL IM BEING WATERED!"); print("EBL IM BEING WATERED!");
_this.cactusDimensions = Vec3.sum(_this.cactusDimensions, {x: 0, y: 0.01, z: 0});
// Need to raise up cactus as it stretches so it doesnt burst out the bottom of the plant
_this.cactusPosition = Vec3.sum(_this.cactusPosition, {x: 0, y: _this.cactusHeightMovement, z: 0});
Entities.editEntity(_this.cactus, {dimensions: _this.cactusDimensions, position: _this.cactusPosition});
}, },
createFlowers: function() { createFlowers: function() {
@ -72,16 +76,18 @@
createCactus: function() { createCactus: function() {
var MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cactus.fbx" var MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cactus.fbx"
var dimensions = { _this.cactusDimensions = {
x: 0.09, x: 0.09,
y: 0.01, y: 0.01,
z: 0.09 z: 0.09
}; };
_this.cactusHeightMovement = _this.cactusDimensions.y/2;
_this.cactusPosition = _this.position;
_this.cactus = Entities.addEntity({ _this.cactus = Entities.addEntity({
type: "Model", type: "Model",
modelURL: MODEL_URL, modelURL: MODEL_URL,
position: _this.position, position: _this.cactusPosition,
dimensions: dimensions dimensions: _this.cactusDimensions
}); });