mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 00:23:33 +02:00
growing flowers faster
This commit is contained in:
parent
4cf5f41eed
commit
aead16da89
5 changed files with 94 additions and 84 deletions
|
@ -32,5 +32,5 @@ function createTidyGuy() {
|
|||
var tidyGuy = createTidyGuy();
|
||||
|
||||
Script.scriptEnding.connect(function() {
|
||||
// Entities.deleteEntity(tidyGuy);
|
||||
Entities.deleteEntity(tidyGuy);
|
||||
})
|
|
@ -19,7 +19,6 @@
|
|||
function GrowingPlant() {
|
||||
_this = this;
|
||||
_this.flowers = [];
|
||||
// _this.STARTING_FLOWER_DIMENSIONS = {x: 0.1, y: 0.001, z: 0.1}
|
||||
_this.STARTING_FLOWER_DIMENSIONS = {
|
||||
x: 0.001,
|
||||
y: 0.001,
|
||||
|
@ -34,9 +33,9 @@
|
|||
max: 1000
|
||||
};
|
||||
_this.canCreateFlower = true;
|
||||
// _this.SHADER_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/shaders/flower.fs";
|
||||
_this.SHADER_URL = "atp:/shaders/flower.fs";
|
||||
// _this.SHADER_URL = "file:///C:/Users/Eric/hifi/unpublishedScripts/DomainContent/Home/plant/flower.fs";
|
||||
// _this.SHADER_URL = "atp:/shaders/flower.fs";
|
||||
// EBL REMOVE ME
|
||||
_this.SHADER_URL = Script.resolvePath("flower.fs");
|
||||
|
||||
_this.flowerHSLColors = [{
|
||||
hue: 19 / 360,
|
||||
|
@ -77,10 +76,10 @@
|
|||
// Reduces flower overlap
|
||||
return;
|
||||
}
|
||||
var xzGrowthRate = randFloat(0.00006, 0.00016);
|
||||
var xzGrowthRate = randFloat(0.0009, 0.0026);
|
||||
var growthRate = {
|
||||
x: xzGrowthRate,
|
||||
y: randFloat(0.001, 0.003),
|
||||
y: randFloat(0.01, 0.03),
|
||||
z: xzGrowthRate
|
||||
};
|
||||
|
||||
|
@ -92,17 +91,7 @@
|
|||
},
|
||||
startingPosition: position,
|
||||
rotation: Quat.rotationBetween(Vec3.UNIT_Y, surfaceNormal),
|
||||
maxYDimension: randFloat(0.4, 1.1),
|
||||
// startingHSLColor: {
|
||||
// hue: 80 / 360,
|
||||
// saturation: 0.47,
|
||||
// light: 0.48
|
||||
// },
|
||||
// endingHSLColor: {
|
||||
// hue: 19 / 260,
|
||||
// saturation: 0.92,
|
||||
// light: 0.41
|
||||
// },
|
||||
maxYDimension: randFloat(0.8, 1.7),
|
||||
hslColor: Math.random() < 0.5 ? _this.flowerHSLColors[0] : _this.flowerHSLColors[1],
|
||||
growthRate: growthRate
|
||||
};
|
||||
|
@ -121,7 +110,7 @@
|
|||
};
|
||||
flower.id = Entities.addEntity({
|
||||
type: "Sphere",
|
||||
name: "flower",
|
||||
name: "home-sphere-flower",
|
||||
lifetime: 3600,
|
||||
position: position,
|
||||
collisionless: true,
|
||||
|
@ -136,12 +125,6 @@
|
|||
}
|
||||
flower.dimensions = Vec3.sum(flower.dimensions, flower.growthRate);
|
||||
flower.position = Vec3.sum(flower.startingPosition, Vec3.multiply(Quat.getUp(flower.rotation), flower.dimensions.y / 2));
|
||||
//As we grow we must also move ourselves in direction we grow!
|
||||
//TODO: Add this color changing back once we fix bug https://app.asana.com/0/inbox/31759584831096/96943843100173/98022172055918
|
||||
// var newHue = map(flower.dimensions.y, _this.STARTING_FLOWER_DIMENSIONS.y, flower.maxYDimension, flower.startingHSLColor.hue, flower.endingHSLColor.hue);
|
||||
// var newSaturation = map(flower.dimensions.y, _this.STARTING_FLOWER_DIMENSIONS.y, flower.maxYDimension, flower.startingHSLColor.saturation, flower.endingHSLColor.saturation);
|
||||
// var newLight = map(flower.dimensions.y, _this.STARTING_FLOWER_DIMENSIONS.y, flower.maxYDimension, flower.startingHSLColor.light, flower.endingHSLColor.light);
|
||||
// flower.userData.PrsoceduralEntity.uniforms.iHSLColor = [newHue, newSaturation, newLight];
|
||||
Entities.editEntity(flower.id, {
|
||||
dimensions: flower.dimensions,
|
||||
position: flower.position,
|
||||
|
@ -155,6 +138,12 @@
|
|||
_this.entityID = entityID;
|
||||
},
|
||||
|
||||
unload: function() {
|
||||
_this.flowers.forEach(function(flower) {
|
||||
Entities.deleteEntity(flower.id);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// entity scripts always need to return a newly constructed object of our type
|
||||
|
|
|
@ -91,12 +91,12 @@
|
|||
return;
|
||||
}
|
||||
// Check rotation of water can along it's z axis. If it's beyond a threshold, then start spraying water
|
||||
_this.castRay();
|
||||
var rotation = Entities.getEntityProperties(_this.entityID, "rotation").rotation;
|
||||
var pitch = Quat.safeEulerAngles(rotation).x;
|
||||
if (pitch < _this.POUR_ANGLE_THRESHOLD) {
|
||||
// Water is pouring
|
||||
var spoutProps = Entities.getEntityProperties(_this.waterSpout, ["rotation", "position"]);
|
||||
_this.castRay();
|
||||
if (!_this.waterPouring) {
|
||||
Entities.editEntity(_this.waterEffect, {
|
||||
isEmitting: true
|
||||
|
@ -201,7 +201,9 @@
|
|||
alpha: 1.0,
|
||||
alphaFinish: 1.0,
|
||||
emitterShouldTrail: true,
|
||||
textures: "atp:/growingPlant/raindrop.png",
|
||||
// textures: "atp:/growingPlant/raindrop.png",
|
||||
//EBL REMOVE ME
|
||||
textures: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/raindrop.png",
|
||||
userData: JSON.stringify({
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
var PLANT_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/growingPlantEntityScript.js");
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/waterCanEntityScript.js");
|
||||
|
||||
//
|
||||
// var PLANT_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/growingPlantEntityScript.js");
|
||||
// var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/growingPlant/waterCanEntityScript.js");
|
||||
|
||||
//EBL REMOVE ME
|
||||
var PLANT_SCRIPT_URL = Script.resolvePath("growingPlantEntityScript.js");
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js");
|
||||
Plant = function(spawnPosition, spawnRotation) {
|
||||
print("EBL PLANT CONSTRUCTOR!")
|
||||
var orientation;
|
||||
|
@ -21,8 +27,11 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
}
|
||||
print("EBL ORIENTATION " + JSON.stringify(orientation));
|
||||
var bowlPosition = spawnPosition;
|
||||
var BOWL_MODEL_URL = "atp:/growingPlant/Flowers-Bowl.fbx";
|
||||
// var BOWL_MODEL_URL = "atp:/growingPlant/Flowers-Bowl.fbx";
|
||||
var BOWL_COLLISION_HULL_URL = "atp:/growingPlant/bowl.obj";
|
||||
|
||||
//EBL REMOVE ME
|
||||
var BOWL_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Bowl.fbx";
|
||||
var bowlDimensions = {
|
||||
x: 0.518,
|
||||
y: 0.1938,
|
||||
|
@ -32,9 +41,9 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
type: "Model",
|
||||
modelURL: BOWL_MODEL_URL,
|
||||
dimensions: bowlDimensions,
|
||||
dynamic: true,
|
||||
shapeType: 'compound',
|
||||
compundShapeURL: BOWL_COLLISION_HULL_URL,
|
||||
// dynamic: true,
|
||||
shapeType: 'box',
|
||||
// compoundShapeURL: BOWL_COLLISION_HULL_URL,
|
||||
name: "plant bowl",
|
||||
position: bowlPosition,
|
||||
userData: JSON.stringify({
|
||||
|
@ -46,8 +55,9 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
|
||||
|
||||
|
||||
var PLANT_MODEL_URL = "atp:/growingPlant/Flowers-Rock.fbx";
|
||||
|
||||
//var PLANT_MODEL_URL = "atp:/growingPlant/Flowers-Rock.fbx";
|
||||
//EBL REMOVE ME
|
||||
var PLANT_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Moss-Rock.fbx";
|
||||
var plantDimensions = {
|
||||
x: 0.52,
|
||||
y: 0.2600,
|
||||
|
@ -74,14 +84,16 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
});
|
||||
|
||||
|
||||
var WATER_CAN_MODEL_URL = "atp:/growingPlant/waterCan.fbx";
|
||||
// var WATER_CAN_MODEL_URL = "atp:/growingPlant/waterCan.fbx";
|
||||
// EBL REMOVE ME
|
||||
var WATER_CAN_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/waterCan.fbx?v1" + Math.random();
|
||||
var WATER_CAN_COLLIISION_HULL_URL = "atp:/growingPlant/can.obj";
|
||||
var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation)));
|
||||
var waterCanRotation = orientation;
|
||||
var waterCan = Entities.addEntity({
|
||||
type: "Model",
|
||||
shapeType: 'compound',
|
||||
compundShapeURL: WATER_CAN_COLLIISION_HULL_URL,
|
||||
shapeType: 'box',
|
||||
// compoundShapeURL: WATER_CAN_COLLIISION_HULL_URL,
|
||||
name: "hifi-water-can",
|
||||
modelURL: WATER_CAN_MODEL_URL,
|
||||
script: WATER_CAN_SCRIPT_URL,
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
|
||||
var whiteboardPath = Script.resolvePath("atp:/whiteboard/wrapper.js");
|
||||
|
||||
var plantPath = Script.resolvePath("atp:/growingPlant/wrapper.js");
|
||||
// var plantPath = Script.resolvePath("atp:/growingPlant/wrapper.js");
|
||||
|
||||
//EBL REMOVE ME
|
||||
var myPlant;
|
||||
var plantPath = Script.resolvePath("growingPlant/wrapper.js?v1" + Math.random());
|
||||
|
||||
var cuckooClockPath = Script.resolvePath("atp:/cuckooClock/wrapper.js");
|
||||
|
||||
|
@ -109,16 +113,16 @@
|
|||
_this.showTidyingButton();
|
||||
_this.playTidyingSound();
|
||||
|
||||
_this.findAndDeleteHomeEntities();
|
||||
// _this.findAndDeleteHomeEntities();
|
||||
Script.setTimeout(function() {
|
||||
_this.showTidyButton();
|
||||
_this.tidying = false;
|
||||
}, 2500);
|
||||
|
||||
Script.setTimeout(function() {
|
||||
_this.createKineticEntities();
|
||||
// _this.createKineticEntities();
|
||||
_this.createDynamicEntities();
|
||||
_this.setupDressingRoom();
|
||||
// _this.setupDressingRoom();
|
||||
}, 750)
|
||||
|
||||
|
||||
|
@ -138,33 +142,33 @@
|
|||
},
|
||||
|
||||
createDynamicEntities: function() {
|
||||
var fishTank = new FishTank({
|
||||
x: 1099.2200,
|
||||
y: 460.5460,
|
||||
z: -78.2363
|
||||
}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
});
|
||||
// var fishTank = new FishTank({
|
||||
// x: 1099.2200,
|
||||
// y: 460.5460,
|
||||
// z: -78.2363
|
||||
// }, {
|
||||
// x: 0,
|
||||
// y: 0,
|
||||
// z: 0
|
||||
// });
|
||||
|
||||
var tiltMaze = new TiltMaze({
|
||||
x: 1105.5768,
|
||||
y: 460.3298,
|
||||
z: -80.4891
|
||||
});
|
||||
// var tiltMaze = new TiltMaze({
|
||||
// x: 1105.5768,
|
||||
// y: 460.3298,
|
||||
// z: -80.4891
|
||||
// });
|
||||
|
||||
var whiteboard = new Whiteboard({
|
||||
x: 1104,
|
||||
y: 460.5,
|
||||
z: -77
|
||||
}, {
|
||||
x: 0,
|
||||
y: -133,
|
||||
z: 0
|
||||
});
|
||||
// var whiteboard = new Whiteboard({
|
||||
// x: 1104,
|
||||
// y: 460.5,
|
||||
// z: -77
|
||||
// }, {
|
||||
// x: 0,
|
||||
// y: -133,
|
||||
// z: 0
|
||||
// });
|
||||
|
||||
var myPlant = new Plant({
|
||||
myPlant = new Plant({
|
||||
x: 1099.8785,
|
||||
y: 460.3115,
|
||||
z: -84.7736
|
||||
|
@ -174,24 +178,24 @@
|
|||
z: 0
|
||||
});
|
||||
|
||||
var pingPongGun = new HomePingPongGun({
|
||||
x: 1101.2123,
|
||||
y: 460.2328,
|
||||
z: -65.8513
|
||||
}, {
|
||||
x: 97.3683,
|
||||
y: 179.0293,
|
||||
z: 89.9698
|
||||
});
|
||||
var cuckooClock = new MyCuckooClock({
|
||||
x: 1105.267,
|
||||
y: 461.44,
|
||||
z: -81.9495
|
||||
}, {
|
||||
x: 0,
|
||||
y: -57,
|
||||
z: 0
|
||||
});
|
||||
// var pingPongGun = new HomePingPongGun({
|
||||
// x: 1101.2123,
|
||||
// y: 460.2328,
|
||||
// z: -65.8513
|
||||
// }, {
|
||||
// x: 97.3683,
|
||||
// y: 179.0293,
|
||||
// z: 89.9698
|
||||
// });
|
||||
// var cuckooClock = new MyCuckooClock({
|
||||
// x: 1105.267,
|
||||
// y: 461.44,
|
||||
// z: -81.9495
|
||||
// }, {
|
||||
// x: 0,
|
||||
// y: -57,
|
||||
// z: 0
|
||||
// });
|
||||
|
||||
//v2.0
|
||||
// var musicBox = new MusicBox();
|
||||
|
@ -457,6 +461,9 @@
|
|||
|
||||
unload: function() {
|
||||
// this.findAndDeleteHomeEntities();
|
||||
//REMOVE ME
|
||||
myPlant.cleanup();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue