From 9ff4540697a9a5ca40fc7bbcb1d2ddd7ad08d33e Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 31 Mar 2016 16:45:12 -0700 Subject: [PATCH] growing plant fixes --- .../growingPlant/growingPlantEntityScript.js | 4 +- .../Home/growingPlant/waterCanEntityScript.js | 10 +- .../Home/growingPlant/wrapper.js | 30 ++---- .../DomainContent/Home/reset.js | 97 +++++++++---------- 4 files changed, 62 insertions(+), 79 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/growingPlant/growingPlantEntityScript.js b/unpublishedScripts/DomainContent/Home/growingPlant/growingPlantEntityScript.js index 8c60f97722..7c3d89d585 100644 --- a/unpublishedScripts/DomainContent/Home/growingPlant/growingPlantEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/growingPlant/growingPlantEntityScript.js @@ -33,9 +33,7 @@ max: 1000 }; _this.canCreateFlower = true; - // _this.SHADER_URL = "atp:/shaders/flower.fs"; - // EBL REMOVE ME - _this.SHADER_URL = Script.resolvePath("flower.fs"); + _this.SHADER_URL = "atp:/shaders/flower.fs"; _this.flowerHSLColors = [{ hue: 19 / 360, diff --git a/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js b/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js index 93ea4a33cc..972b7f2d77 100644 --- a/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/growingPlant/waterCanEntityScript.js @@ -86,12 +86,12 @@ var forwardVec = Quat.getFront(rotation); if (forwardVec.y < _this.POUR_ANGLE_THRESHOLD) { // Water is pouring - var spoutProps = Entities.getEntityProperties(_this.waterSpout, ["rotation", "position"]); + _this.spoutProps= Entities.getEntityProperties(_this.waterSpout, ["rotation", "position"]); _this.castRay(); if (!_this.waterPouring) { _this.startPouring(); } - _this.waterSpoutRotation = spoutProps.rotation; + _this.waterSpoutRotation = _this.spoutProps.rotation; var waterEmitOrientation = Quat.multiply(_this.waterSpoutRotation, Quat.fromPitchYawRollDegrees(0, 180, 0)); Entities.editEntity(_this.waterEffect, { emitOrientation: waterEmitOrientation @@ -125,7 +125,7 @@ _this.waterPouring = true; if (!_this.waterInjector) { _this.waterInjector = Audio.playSound(_this.waterSound, { - position: spoutProps.position, + position: _this.spoutProps.position, loop: true }); @@ -214,9 +214,7 @@ alpha: 1.0, alphaFinish: 1.0, emitterShouldTrail: true, - // textures: "atp:/growingPlant/raindrop.png", - //EBL REMOVE ME - textures: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/raindrop.png", + textures: "atp:/growingPlant/raindrop.png", userData: JSON.stringify({ 'hifiHomeKey': { 'reset': true diff --git a/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js b/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js index 0a4d97103b..31f46eb43f 100644 --- a/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/growingPlant/wrapper.js @@ -11,12 +11,9 @@ // // -// 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; @@ -27,11 +24,8 @@ Plant = function(spawnPosition, spawnRotation) { } print("EBL ORIENTATION " + JSON.stringify(orientation)); var bowlPosition = spawnPosition; - // var BOWL_MODEL_URL = "atp:/growingPlant/Flowers-Bowl.fbx"; - var BOWL_COLLISION_HULL_URL = "atp:/growingPlant/bowl.obj"; + var BOWL_MODEL_URL = "atp:/growingPlant/Flowers-Bowl.fbx"; -//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, @@ -41,9 +35,9 @@ Plant = function(spawnPosition, spawnRotation) { type: "Model", modelURL: BOWL_MODEL_URL, dimensions: bowlDimensions, - // dynamic: true, - shapeType: 'box', - // compoundShapeURL: BOWL_COLLISION_HULL_URL, + dynamic: true, + shapeType: 'compound', + compoundShapeURL: BOWL_COLLISION_HULL_URL, name: "home_model_plantNowl", position: bowlPosition, userData: JSON.stringify({ @@ -55,9 +49,7 @@ Plant = function(spawnPosition, spawnRotation) { - //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 PLANT_MODEL_URL = "atp:/growingPlant/Flowers-Rock.fbx"; var plantDimensions = { x: 0.52, y: 0.2600, @@ -84,16 +76,14 @@ Plant = function(spawnPosition, spawnRotation) { }); - // 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_MODEL_URL = "atp:/growingPlant/waterCan.fbx"; 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: 'box', - // compoundShapeURL: WATER_CAN_COLLIISION_HULL_URL, + shapeType: 'compound', + compoundShapeURL: WATER_CAN_COLLIISION_HULL_URL, name: "home_model_waterCan", modelURL: WATER_CAN_MODEL_URL, script: WATER_CAN_SCRIPT_URL, diff --git a/unpublishedScripts/DomainContent/Home/reset.js b/unpublishedScripts/DomainContent/Home/reset.js index 86c893b266..7362932f99 100644 --- a/unpublishedScripts/DomainContent/Home/reset.js +++ b/unpublishedScripts/DomainContent/Home/reset.js @@ -28,11 +28,10 @@ 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"); @@ -113,16 +112,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) @@ -142,31 +141,31 @@ }, 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 + }); myPlant = new Plant({ x: 1099.8785, @@ -178,26 +177,26 @@ 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 + // v2.0 // var musicBox = new MusicBox(); // var doppelganger = new Doppelganger(); @@ -460,9 +459,7 @@ }, unload: function() { - // this.findAndDeleteHomeEntities(); - //REMOVE ME - myPlant.cleanup(); + this.findAndDeleteHomeEntities(); }