mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #14 from ericrius1/homereset
Added posters and bulldog lamp and new watercan sounds to home
This commit is contained in:
commit
5708d2e6f0
11 changed files with 288 additions and 169 deletions
|
@ -34,7 +34,8 @@
|
|||
max: 1000
|
||||
};
|
||||
_this.canCreateFlower = true;
|
||||
_this.SHADER_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/shaders/flower.fs";
|
||||
// _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.flowerHSLColors = [{
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
function WaterSpout() {
|
||||
_this = this;
|
||||
_this.waterSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/shower.wav");
|
||||
_this.waterSound = SoundCache.getSound("atp:/sounds/watering_can_pour.L.wav");
|
||||
_this.POUR_ANGLE_THRESHOLD = 0;
|
||||
_this.waterPouring = false;
|
||||
_this.WATER_SPOUT_NAME = "hifi-water-spout";
|
||||
|
@ -197,7 +197,7 @@
|
|||
alpha: 1.0,
|
||||
alphaFinish: 1.0,
|
||||
emitterShouldTrail: true,
|
||||
textures: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/raindrop.png",
|
||||
textures: "atp:/images/raindrop.png",
|
||||
userData: JSON.stringify({
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
// 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("growingPlantEntityScript.js?v1" + Math.random().toFixed(2));
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("waterCanEntityScript.js?v2" + Math.random().toFixed());
|
||||
var PLANT_SCRIPT_URL = Script.resolvePath("atp:/scripts/growingPlantEntityScript.js?v1" + Math.random());
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("atp:/scripts/waterCanEntityScript.js?v1" + Math.random());
|
||||
Plant = function(spawnPosition, spawnRotation) {
|
||||
var orientation;
|
||||
if (spawnRotation !== undefined) {
|
||||
|
@ -20,7 +20,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
}
|
||||
print("EBL ORIENTATION " + JSON.stringify(orientation));
|
||||
var bowlPosition = spawnPosition;
|
||||
var BOWL_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Bowl.fbx";
|
||||
var BOWL_MODEL_URL = "atp:/models/Flowers-Bowl.fbx";
|
||||
var bowlDimensions = {
|
||||
x: 0.518,
|
||||
y: 0.1938,
|
||||
|
@ -40,7 +40,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
});
|
||||
|
||||
|
||||
var PLANT_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Moss-Rock.fbx";
|
||||
var PLANT_MODEL_URL = "atp:/models/Flowers-Rock.fbx";
|
||||
|
||||
var plantDimensions = {
|
||||
x: 0.52,
|
||||
|
@ -68,7 +68,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
});
|
||||
|
||||
|
||||
var WATER_CAN_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/waterCan.fbx";
|
||||
var WATER_CAN_MODEL_URL = "atp:/models/waterCan.fbx";
|
||||
|
||||
var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation)));
|
||||
var waterCanRotation = orientation;
|
||||
|
@ -84,6 +84,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
z: 0.4115
|
||||
},
|
||||
position: waterCanPosition,
|
||||
collisionSoundURL: "atp:/sounds/watering_can_drop.L.wav",
|
||||
angularDamping: 1,
|
||||
dynamic: true,
|
||||
gravity: {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Entities": [{
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
|
||||
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/simple-chair2.obj",
|
||||
"name": "hifi-home-model-chair",
|
||||
"compoundShapeURL": "atp:/collision-hulls/simple-chair2.obj",
|
||||
"created": "2016-03-07T21:07:29Z",
|
||||
"dimensions": {
|
||||
"x": 0.66077238321304321,
|
||||
|
@ -15,7 +16,7 @@
|
|||
"z": 0
|
||||
},
|
||||
"id": "{d97c8a4e-9b95-448c-a729-5da9e22b6adc}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/simple-chair2.fbx",
|
||||
"modelURL": "atp:/models/simple-chair2.fbx",
|
||||
"queryAACube": {
|
||||
"scale": 1.439794659614563,
|
||||
"x": -0.71989732980728149,
|
||||
|
|
|
@ -1,89 +1,181 @@
|
|||
{
|
||||
"Entities": [{
|
||||
"angularVelocity": {
|
||||
"x": -0.00071254139766097069,
|
||||
"y": 0.0045778844505548477,
|
||||
"z": -0.0034651262685656548
|
||||
"Entities": [
|
||||
{
|
||||
"angularVelocity": {
|
||||
"x": -0.026321493089199066,
|
||||
"y": -0.028931867331266403,
|
||||
"z": 0.010236549191176891
|
||||
},
|
||||
"collisionsWillMove": 1,
|
||||
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.obj",
|
||||
"created": "2016-03-22T22:55:11Z",
|
||||
"dimensions": {
|
||||
"x": 0.35158795118331909,
|
||||
"y": 0.27823561429977417,
|
||||
"z": 0.35158795118331909
|
||||
},
|
||||
"dynamic": 1,
|
||||
"gravity": {
|
||||
"x": 0,
|
||||
"y": -2,
|
||||
"z": 0
|
||||
},
|
||||
"id": "{747a8714-3cc5-4336-bac3-de3c8ec1494d}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.fbx",
|
||||
"name": "hifi-home-model-bulldog-shade",
|
||||
"position": {
|
||||
"x": 0.085205078125,
|
||||
"y": 0.5194091796875,
|
||||
"z": 0
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.56977474689483643,
|
||||
"x": -0.19968229532241821,
|
||||
"y": 0.23452180624008179,
|
||||
"z": -0.28488737344741821
|
||||
},
|
||||
"restitution": 0.20000000298023224,
|
||||
"rotation": {
|
||||
"w": 0.98912078142166138,
|
||||
"x": -0.0035601628478616476,
|
||||
"y": -0.14705567061901093,
|
||||
"z": 0.0014477154472842813
|
||||
},
|
||||
"shapeType": "compound",
|
||||
"type": "Model",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
|
||||
"velocity": {
|
||||
"x": 0.0051150284707546234,
|
||||
"y": 0.00043292529881000519,
|
||||
"z": 0.00053954275790601969
|
||||
}
|
||||
},
|
||||
"collisionsWillMove": 1,
|
||||
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.obj",
|
||||
"created": "2016-03-22T22:55:11Z",
|
||||
"dimensions": {
|
||||
"x": 0.35158795118331909,
|
||||
"y": 0.27823561429977417,
|
||||
"z": 0.35158795118331909
|
||||
{
|
||||
"angularVelocity": {
|
||||
"x": -0.0016508022090420127,
|
||||
"y": 0.00053207820747047663,
|
||||
"z": -0.0033033043146133423
|
||||
},
|
||||
"collisionsWillMove": 1,
|
||||
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.obj",
|
||||
"created": "2016-03-22T22:50:49Z",
|
||||
"dimensions": {
|
||||
"x": 0.26436957716941833,
|
||||
"y": 0.73171323537826538,
|
||||
"z": 0.26436954736709595
|
||||
},
|
||||
"dynamic": 1,
|
||||
"gravity": {
|
||||
"x": 0,
|
||||
"y": -9,
|
||||
"z": 0
|
||||
},
|
||||
"id": "{5dcc642f-34a6-44a7-8da8-275cbbbef9d6}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.fbx",
|
||||
"name": "hifi-home-model-bulldog-base",
|
||||
"position": {
|
||||
"x": 0.08642578125,
|
||||
"y": 0.306884765625,
|
||||
"z": 0.00026702880859375
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.82169753313064575,
|
||||
"x": -0.32442298531532288,
|
||||
"y": -0.10396400094032288,
|
||||
"z": -0.41058173775672913
|
||||
},
|
||||
"rotation": {
|
||||
"w": 0.84591019153594971,
|
||||
"x": -6.7644752562046051e-05,
|
||||
"y": -0.53332537412643433,
|
||||
"z": 8.2868709796457551e-06
|
||||
},
|
||||
"shapeType": "compound",
|
||||
"type": "Model",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
|
||||
"velocity": {
|
||||
"x": 0.0011470125755295157,
|
||||
"y": 0.0010520070791244507,
|
||||
"z": -0.0011547321919351816
|
||||
}
|
||||
},
|
||||
"dynamic": 1,
|
||||
"gravity": {
|
||||
"x": 0,
|
||||
"y": -2,
|
||||
"z": 0
|
||||
{
|
||||
"color": {
|
||||
"blue": 68,
|
||||
"green": 252,
|
||||
"red": 243
|
||||
},
|
||||
"created": "2016-03-24T22:21:38Z",
|
||||
"cutoff": 90,
|
||||
"dimensions": {
|
||||
"x": 4,
|
||||
"y": 4,
|
||||
"z": 4
|
||||
},
|
||||
"falloffRadius": 0.30000001192092896,
|
||||
"id": "{1f15e48e-66cd-4ecd-8d60-a391f050ec8d}",
|
||||
"intensity": 20,
|
||||
"isSpotlight": 1,
|
||||
"name": "hifi-home-living-room-desk-lamp-spotlight",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0.727783203125
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 6.9282031059265137,
|
||||
"x": -3.4641015529632568,
|
||||
"y": -3.4641015529632568,
|
||||
"z": -2.7363183498382568
|
||||
},
|
||||
"rotation": {
|
||||
"w": 0.63591969013214111,
|
||||
"x": 0.26338601112365723,
|
||||
"y": -0.27760738134384155,
|
||||
"z": -0.67016100883483887
|
||||
},
|
||||
"type": "Light",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
|
||||
},
|
||||
"id": "{638e562d-77cc-45ee-b2c7-f5c678cf83eb}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.fbx",
|
||||
"position": {
|
||||
"x": 1104.558349609375,
|
||||
"y": 460.93505859375,
|
||||
"z": 0
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.56977474689483643,
|
||||
"x": 1104.2734375,
|
||||
"y": 460.65017700195312,
|
||||
"z": -0.28488737344741821
|
||||
},
|
||||
"restitution": 0.20000000298023224,
|
||||
"rotation": {
|
||||
"w": 0.80972349643707275,
|
||||
"x": 8.0799843999557197e-05,
|
||||
"y": -0.58680325746536255,
|
||||
"z": 0.0031326396856456995
|
||||
},
|
||||
"shapeType": "compound",
|
||||
"type": "Model",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
|
||||
}, {
|
||||
"angularVelocity": {
|
||||
"x": -0.0025625245179980993,
|
||||
"y": -0.00052156101446598768,
|
||||
"z": 0.000514673360157758
|
||||
},
|
||||
"collisionsWillMove": 1,
|
||||
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.obj",
|
||||
"created": "2016-03-22T22:50:49Z",
|
||||
"dimensions": {
|
||||
"x": 0.26436957716941833,
|
||||
"y": 0.73171323537826538,
|
||||
"z": 0.26436954736709595
|
||||
},
|
||||
"dynamic": 1,
|
||||
"gravity": {
|
||||
"x": 0,
|
||||
"y": -9,
|
||||
"z": 0
|
||||
},
|
||||
"id": "{1fdc3a04-fbee-4f23-bdf8-c44c58258388}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.fbx",
|
||||
"position": {
|
||||
"x": 1104.5577392578125,
|
||||
"y": 460.7225341796875,
|
||||
"z": 0.0018768310546875
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.82169753313064575,
|
||||
"x": 1104.1468505859375,
|
||||
"y": 460.31167602539062,
|
||||
"z": -0.40897193551063538
|
||||
},
|
||||
"rotation": {
|
||||
"w": 0.98707658052444458,
|
||||
"x": -5.647468424285762e-05,
|
||||
"y": -0.16024939715862274,
|
||||
"z": 2.5912273486028425e-05
|
||||
},
|
||||
"shapeType": "compound",
|
||||
"type": "Model",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
|
||||
}],
|
||||
{
|
||||
"collisionless": 1,
|
||||
"color": {
|
||||
"blue": 0,
|
||||
"green": 0,
|
||||
"red": 255
|
||||
},
|
||||
"created": "2016-03-24T22:17:16Z",
|
||||
"dimensions": {
|
||||
"x": 0.15776367485523224,
|
||||
"y": 0.26723021268844604,
|
||||
"z": 0.16535492241382599
|
||||
},
|
||||
"id": "{51eb700c-62ba-4e1d-813a-2c23deb02e26}",
|
||||
"ignoreForCollisions": 1,
|
||||
"name": "hifi-home-living-room-desk-lamp-trigger",
|
||||
"position": {
|
||||
"x": 0.09033203125,
|
||||
"y": 0.149169921875,
|
||||
"z": 0.00484466552734375
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.35162994265556335,
|
||||
"x": -0.085482940077781677,
|
||||
"y": -0.026645049452781677,
|
||||
"z": -0.17097030580043793
|
||||
},
|
||||
"rotation": {
|
||||
"w": 1,
|
||||
"x": -1.52587890625e-05,
|
||||
"y": -1.52587890625e-05,
|
||||
"z": -1.52587890625e-05
|
||||
},
|
||||
"script": "https://rawgit.com/ericrius1/hifi/homereset/unpublishedScripts/DomainContent/Home/switches/livingRoomDeskLamp.js",
|
||||
"scriptTimestamp": 1458860464095,
|
||||
"type": "Box",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true},\"grabbableKey\":{\"wantsTrigger\":true},\"home-switch\":{\"state\":\"on\"}}",
|
||||
"visible": 0
|
||||
}
|
||||
],
|
||||
"Version": 57
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,16 +13,10 @@
|
|||
},
|
||||
"id": "{fb17c832-d450-4293-a9b5-5b2d0425e8fc}",
|
||||
"name": "Poster-Nail",
|
||||
"position": {
|
||||
"x": 1103.8148193359375,
|
||||
"y": 461.78707885742188,
|
||||
"z": 3.0988998413085938
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.25164666771888733,
|
||||
"x": 1103.68896484375,
|
||||
"y": 461.6612548828125,
|
||||
"z": 2.9730765819549561
|
||||
"position" : {
|
||||
"x": -0.05,
|
||||
"y": 0.4,
|
||||
"z": 0.1
|
||||
},
|
||||
"rotation": {
|
||||
"w": 0.96362245082855225,
|
||||
|
@ -30,6 +24,12 @@
|
|||
"y": 0.26723122596740723,
|
||||
"z": -1.52587890625e-05
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.25164666771888733,
|
||||
"x": 1103.68896484375,
|
||||
"y": 461.6612548828125,
|
||||
"z": 2.9730765819549561
|
||||
},
|
||||
"type": "Box",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
|
||||
}, {
|
||||
|
@ -49,23 +49,14 @@
|
|||
},
|
||||
"id": "{9eec1faa-9e1a-4d76-abeb-a1b1175a44d5}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Cellscience-Poster-2.fbx",
|
||||
"position": {
|
||||
"x": 1103.866943359375,
|
||||
"y": 461.2822265625,
|
||||
"z": 3.0254440307617188
|
||||
},
|
||||
"name": "hifi-home-poster-cell",
|
||||
"queryAACube": {
|
||||
"scale": 1.4568163156509399,
|
||||
"x": 1103.1385498046875,
|
||||
"y": 460.5538330078125,
|
||||
"z": 2.2970359325408936
|
||||
},
|
||||
"rotation": {
|
||||
"w": -0.28834974765777588,
|
||||
"x": 0.023819327354431152,
|
||||
"y": 0.95718324184417725,
|
||||
"z": -0.0075837373733520508
|
||||
},
|
||||
"rotation": {"x":0.000021114425180712715,"y":-0.9585217833518982,"z":-0.000005921703177591553,"w":0.285019189119339},
|
||||
"shapeType": "compound",
|
||||
"type": "Model",
|
||||
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
|
||||
|
|
|
@ -14,13 +14,9 @@
|
|||
"y": -2,
|
||||
"z": 0
|
||||
},
|
||||
"name": "hifi-home-poster-playa",
|
||||
"id": "{2b5ca0a0-9115-4916-bee6-63f88d3909b1}",
|
||||
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Playa-Poster.fbx",
|
||||
"position": {
|
||||
"x": 1101.8731689453125,
|
||||
"y": 461.19500732421875,
|
||||
"z": 0
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 1.5361770391464233,
|
||||
"x": 1101.1051025390625,
|
||||
|
@ -51,10 +47,10 @@
|
|||
},
|
||||
"id": "{7f060027-2927-4513-bd92-13a98e6fc06c}",
|
||||
"name": "Poster-Nail",
|
||||
"position": {
|
||||
"x": 1101.77685546875,
|
||||
"y": 461.72821044921875,
|
||||
"z": 0.0442657470703125
|
||||
"position" : {
|
||||
"x": -0.07,
|
||||
"y": 0.5,
|
||||
"z": 0.07
|
||||
},
|
||||
"queryAACube": {
|
||||
"scale": 0.25164666771888733,
|
||||
|
|
|
@ -5,7 +5,7 @@ var UPPER_BOOKSHELF_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Ho
|
|||
var LOWER_BOOKSHELF_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/lowerBookShelf.json' + "?" + Math.random();
|
||||
var RIGHT_DESK_DRAWER_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/rightDeskDrawer.json' + "?" + Math.random();
|
||||
var LEFT_DESK_DRAWER_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/leftDeskDrawer.json' + "?" + Math.random();
|
||||
var CHAIR_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/chair.json' + "?" + Math.random();
|
||||
var CHAIR_URL = 'atp:/JSON/chair.json';
|
||||
var DESK_DRAWERS_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/deskDrawers.json' + "?" + Math.random();
|
||||
var FRUIT_BOWL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/fruit.json' + "?" + Math.random()
|
||||
var LAB_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/deskLamp.json' + "?" + Math.random();
|
||||
|
|
|
@ -244,17 +244,24 @@
|
|||
});
|
||||
|
||||
var cellPoster = new PosterCell({
|
||||
x:1103.81,
|
||||
y:461.0729,
|
||||
z:-70.24
|
||||
x:1103.78,
|
||||
y:461,
|
||||
z:-70.3
|
||||
});
|
||||
|
||||
var playaPoster = new PosterPlaya({
|
||||
x:1101.72,
|
||||
y:451.51,
|
||||
z:-73.22
|
||||
x:1101.8,
|
||||
y:461,
|
||||
z:-73.3
|
||||
});
|
||||
|
||||
|
||||
var livingRoomLampTriggerBoxName = "hifi-home-living-room-desk-lamp-trigger";
|
||||
var livingRoomLampModelName = "hifi-home-model-bulldog-base";
|
||||
Script.setTimeout(function() {
|
||||
attachChildToParent(livingRoomLampTriggerBoxName, livingRoomLampModelName, MyAvatar.position, 20);
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
|
||||
findAndDeleteHomeEntities: function() {
|
||||
|
@ -288,4 +295,4 @@
|
|||
|
||||
}
|
||||
return new Reset();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
};
|
||||
|
||||
Switch.prototype = {
|
||||
prefix: 'hifi-home-living-room-desk-lamp',
|
||||
prefix: 'hifi-home-living-room-desk-lamp-',
|
||||
clickReleaseOnEntity: function(entityID, mouseEvent) {
|
||||
if (!mouseEvent.isLeftButton) {
|
||||
return;
|
||||
|
@ -28,13 +28,13 @@
|
|||
|
||||
modelEmitOn: function(discModel) {
|
||||
Entities.editEntity(glowDisc, {
|
||||
textures: 'emissive:' + EMISSIVE_TEXTURE_URL ',\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
modelEmitOff: function(discModel) {
|
||||
Entities.editEntity(glowDisc, {
|
||||
textures: 'emissive:"",\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -44,7 +44,8 @@
|
|||
});
|
||||
},
|
||||
|
||||
masterLightOff: function() {
|
||||
masterLightOff: function(masterLight) {
|
||||
print("EBL TURN LIGHT OFF");
|
||||
Entities.editEntity(masterLight, {
|
||||
visible: false
|
||||
});
|
||||
|
@ -53,10 +54,11 @@
|
|||
|
||||
findMasterLights: function() {
|
||||
var found = [];
|
||||
var results = Entities.findEntities(this.position, SEARCH_RADIUS);
|
||||
var results = Entities.findEntities(_this.position, SEARCH_RADIUS);
|
||||
results.forEach(function(result) {
|
||||
var properties = Entities.getEntityProperties(result);
|
||||
if (properties.name === _this.prefix + "spotlight") {
|
||||
print("EBL FOUND THE SPOTLIGHT!");
|
||||
found.push(result);
|
||||
}
|
||||
});
|
||||
|
@ -76,6 +78,7 @@
|
|||
},
|
||||
|
||||
toggleLights: function() {
|
||||
print("EBL TOGGLE LIGHTS");
|
||||
|
||||
this._switch = getEntityCustomData('home-switch', this.entityID, {
|
||||
state: 'off'
|
||||
|
@ -85,7 +88,7 @@
|
|||
var emitModels = this.findEmitModels();
|
||||
|
||||
if (this._switch.state === 'off') {
|
||||
|
||||
print("EBL TURN LIGHTS ON");
|
||||
masterLights.forEach(function(masterLight) {
|
||||
_this.masterLightOn(masterLight);
|
||||
});
|
||||
|
@ -97,7 +100,7 @@
|
|||
});
|
||||
|
||||
} else {
|
||||
|
||||
print("EBL TURN LIGHTS OFF");
|
||||
masterLights.forEach(function(masterLight) {
|
||||
_this.masterLightOff(masterLight);
|
||||
});
|
||||
|
@ -109,7 +112,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
this.flipSwitch();
|
||||
Audio.playSound(this.switchSound, {
|
||||
volume: 0.5,
|
||||
position: this.position
|
||||
|
@ -117,22 +119,9 @@
|
|||
|
||||
},
|
||||
|
||||
flipSwitch: function() {
|
||||
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
|
||||
var axis = {
|
||||
x: 0,
|
||||
y: 1,
|
||||
z: 0
|
||||
};
|
||||
var dQ = Quat.angleAxis(180, axis);
|
||||
rotation = Quat.multiply(rotation, dQ);
|
||||
|
||||
Entities.editEntity(this.entityID, {
|
||||
rotation: rotation
|
||||
});
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
print("EBL PRELOAD LIGHT SWITCH SCRIPT");
|
||||
this.entityID = entityID;
|
||||
setEntityCustomData('grabbableKey', this.entityID, {
|
||||
wantsTrigger: true
|
||||
|
|
|
@ -11,14 +11,18 @@ map = function(value, min1, max1, min2, max2) {
|
|||
}
|
||||
|
||||
vec3toStr = function(v, digits) {
|
||||
if (!digits) { digits = 3; }
|
||||
return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits)+ " }";
|
||||
if (!digits) {
|
||||
digits = 3;
|
||||
}
|
||||
return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits) + " }";
|
||||
}
|
||||
|
||||
quatToStr = function(q, digits) {
|
||||
if (!digits) { digits = 3; }
|
||||
if (!digits) {
|
||||
digits = 3;
|
||||
}
|
||||
return "{ " + q.w.toFixed(digits) + ", " + q.x.toFixed(digits) + ", " +
|
||||
q.y.toFixed(digits) + ", " + q.z.toFixed(digits)+ " }";
|
||||
q.y.toFixed(digits) + ", " + q.z.toFixed(digits) + " }";
|
||||
}
|
||||
|
||||
vec3equal = function(v0, v1) {
|
||||
|
@ -33,7 +37,7 @@ colorMix = function(colorA, colorB, mix) {
|
|||
return result;
|
||||
}
|
||||
|
||||
scaleLine = function (start, end, scale) {
|
||||
scaleLine = function(start, end, scale) {
|
||||
var v = Vec3.subtract(end, start);
|
||||
var length = Vec3.length(v);
|
||||
v = Vec3.multiply(scale, v);
|
||||
|
@ -61,7 +65,9 @@ addLine = function(origin, vector, color) {
|
|||
// FIXME fetch from a subkey of user data to support non-destructive modifications
|
||||
setEntityUserData = function(id, data) {
|
||||
var json = JSON.stringify(data)
|
||||
Entities.editEntity(id, { userData: json });
|
||||
Entities.editEntity(id, {
|
||||
userData: json
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME do non-destructive modification of the existing user data
|
||||
|
@ -71,7 +77,7 @@ getEntityUserData = function(id) {
|
|||
if (properties.userData) {
|
||||
try {
|
||||
results = JSON.parse(properties.userData);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
logDebug(err);
|
||||
logDebug(properties.userData);
|
||||
}
|
||||
|
@ -169,7 +175,7 @@ findSphereHit = function(point, sphereRadius) {
|
|||
}
|
||||
|
||||
findSpherePointHit = function(sphereCenter, sphereRadius, point) {
|
||||
return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius);
|
||||
return findSphereHit(Vec3.subtract(point, sphereCenter), sphereRadius);
|
||||
}
|
||||
|
||||
findSphereSphereHit = function(firstCenter, firstRadius, secondCenter, secondRadius) {
|
||||
|
@ -188,8 +194,8 @@ getAvatarRelativeRotation = function(q) {
|
|||
|
||||
pointInExtents = function(point, minPoint, maxPoint) {
|
||||
return (point.x >= minPoint.x && point.x <= maxPoint.x) &&
|
||||
(point.y >= minPoint.y && point.y <= maxPoint.y) &&
|
||||
(point.z >= minPoint.z && point.z <= maxPoint.z);
|
||||
(point.y >= minPoint.y && point.y <= maxPoint.y) &&
|
||||
(point.z >= minPoint.z && point.z <= maxPoint.z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,14 +299,49 @@ calculateHandSizeRatio = function() {
|
|||
// Right now units are in cm, so convert to meters
|
||||
wristToFingertipDistance /= 100;
|
||||
|
||||
var centerHandPoint = wristToFingertipDistance/2;
|
||||
var centerHandPoint = wristToFingertipDistance / 2;
|
||||
|
||||
// Compare against standard hand (Owen)
|
||||
var handSizeRatio = centerHandPoint/standardCenterHandPoint;
|
||||
var handSizeRatio = centerHandPoint / standardCenterHandPoint;
|
||||
return handSizeRatio;
|
||||
}
|
||||
|
||||
clamp = function(val, min, max){
|
||||
return Math.max(min, Math.min(max, val))
|
||||
}
|
||||
clamp = function(val, min, max) {
|
||||
return Math.max(min, Math.min(max, val))
|
||||
}
|
||||
|
||||
attachChildToParent = function(childName, parentName, position, searchRadius) {
|
||||
var childEntity, parentEntity;
|
||||
var entities = Entities.findEntities(position, searchRadius)
|
||||
for (var i = 0; i < entities.length; i++) {
|
||||
// first go through and find the entity we want to attach to its parent
|
||||
var entity = entities[i];
|
||||
var name = Entities.getEntityProperties(entity, "name").name;
|
||||
if (name === childName) {
|
||||
childEntity = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!childEntity) {
|
||||
print("You are trying to attach an entity that doesn't exist! Returning");
|
||||
}
|
||||
|
||||
for (var i = 0; i < entities.length; i++) {
|
||||
// first go through and find the entity we want to attach to its parent
|
||||
var entity = entities[i];
|
||||
var name = Entities.getEntityProperties(entity, "name").name;
|
||||
if (name === parentName) {
|
||||
parentEntity = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parentEntity) {
|
||||
print("You are trying to attach an entity to a parent that doesn't exist! Returning");
|
||||
return;
|
||||
}
|
||||
|
||||
print("Successfully attached " + childName + " to " + parentName);
|
||||
Entities.editEntity(childEntity, {parentID: parentEntity});
|
||||
}
|
Loading…
Reference in a new issue