fixed merge conflics

This commit is contained in:
ericrius1 2016-03-18 16:30:17 -07:00
commit f51e7f463c
28 changed files with 1815 additions and 168 deletions

View file

@ -12,7 +12,7 @@
//
(function() {
Script.include('../utils.js');
Script.include('../../../../examples/libraries/virtualBaton.js');
//only one person should simulate the tank at a time -- we pass around a virtual baton
@ -32,11 +32,30 @@
blue: 255
}
var TANK_DIMENSIONS = {
x: 0.8212,
y: 0.8116,
z: 2.1404
};
var LOWER_CORNER_VERTICAL_OFFSET = -TANK_DIMENSIONS.y / 2;
var LOWER_CORNER_FORWARD_OFFSET = TANK_DIMENSIONS.x;
var LOWER_CORNER_LATERAL_OFFSET = -TANK_DIMENSIONS.z / 8;
var UPPER_CORNER_VERTICAL_OFFSET = TANK_DIMENSIONS.y / 2;;
var UPPER_CORNER_FORWARD_OFFSET = -TANK_DIMENSIONS.x;
var UPPER_CORNER_LATERAL_OFFSET = TANK_DIMENSIONS.z / 8;
var upperCorner, lowerCorner;
function FishTank() {
_this = this;
}
function startUpdate() {
upperCorner = getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET);
lowerCorner = getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET);
//when the baton is claimed;
// print('trying to claim the object' + _entityID)
iOwn = true;
@ -121,6 +140,7 @@
preload: function(entityID) {
// print("preload");
this.entityID = entityID;
_entityID = entityID;
this.initialize(entityID);
@ -172,7 +192,12 @@
},
color: INTERSECT_COLOR,
position: position,
collisionless: true
collisionless: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
_this.debugSphere = Entities.addEntity(sphereProperties);
},
@ -238,11 +263,10 @@
_this.overlayLineOn(pickRay.origin, Vec3.sum(pickRay.origin, Vec3.multiply(front, _this.overlayLineDistance)), INTERSECT_COLOR);
};
var brn = _this.userData['hifi-home-fishtank']['corners'].brn;
var tfl = _this.userData['hifi-home-fishtank']['corners'].tfl;
var innerContainer = _this.userData['hifi-home-fishtank'].innerContainer;
var intersection = Entities.findRayIntersection(pickRay, true, [innerContainer], [_this.entityID, brn, tfl]);
var intersection = Entities.findRayIntersection(pickRay, true, [innerContainer], [_this.entityID]);
if (intersection.intersects && intersection.entityID === innerContainer) {
//print('intersecting a tank')
@ -306,16 +330,16 @@
};
//
// flockOfFish.js
// examples
//
// Philip Rosedale
// Copyright 2016 High Fidelity, Inc.
// Fish smimming around in a space in front of you
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// flockOfFish.js
// examples
//
// Philip Rosedale
// Copyright 2016 High Fidelity, Inc.
// Fish smimming around in a space in front of you
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
var FISHTANK_USERDATA_KEY = 'hifi-home-fishtank'
@ -359,6 +383,8 @@
var FISH_MODEL_TWO_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/fishTank/goodfish5.fbx";
var fishLoaded = false;
var lowerCorner, upperCorner;
function randomVector(scale) {
return {
x: Math.random() * scale - scale / 2.0,
@ -377,7 +403,6 @@
return;
}
if (THROTTLE === true) {
sinceLastUpdate = sinceLastUpdate + deltaTime * 100;
if (sinceLastUpdate > THROTTLE_RATE) {
@ -388,8 +413,6 @@
}
// print('has userdata fish??' + _this.userData['hifi-home-fishtank'].fishLoaded)
if (_this.userData['hifi-home-fishtank'].fishLoaded === false) {
//no fish in the user data
_this.tankLocked = true;
@ -398,13 +421,7 @@
var data = {
fishLoaded: true,
bubbleSystem: _this.userData['hifi-home-fishtank'].bubbleSystem,
bubbleSound: _this.userData['hifi-home-fishtank'].bubbleSound,
corners: {
brn: _this.userData['hifi-home-fishtank'].lowerCorner,
tfl: _this.userData['hifi-home-fishtank'].upperCorner
},
innerContainer: _this.userData['hifi-home-fishtank'].innerContainer,
}
setEntityCustomData(FISHTANK_USERDATA_KEY, _this.entityID, data);
_this.userData['hifi-home-fishtank'].fishLoaded = true;
@ -421,7 +438,6 @@
}
var fish = _this.fish;
// print('how many fish do i find?' + fish.length)
@ -442,13 +458,6 @@
z: 0
};
var userData = JSON.parse(_this.currentProperties.userData);
var innerContainer = userData['hifi-home-fishtank']['innerContainer'];
var bounds = Entities.getEntityProperties(innerContainer, "boundingBox").boundingBox;
lowerCorner = bounds.brn;
upperCorner = bounds.tfl;
// First pre-load an array with properties on all the other fish so our per-fish loop
// isn't doing it.
var flockProperties = [];
@ -489,6 +498,7 @@
z: 0
};
var othersCounted = 0;
for (var j = 0; j < fish.length; j++) {
if (i != j) {
@ -519,8 +529,6 @@
//attractors
//[position, radius, force]
}
if (_this.hasLookAttractor === true) {
@ -594,21 +602,22 @@
var STARTING_FRACTION = 0.25;
function loadFish(howMany) {
// print('LOADING FISH: ' + howMany)
print('LOADING FISH: ' + howMany)
var center = _this.currentProperties.position;
lowerCorner = {
var lowerCorner = {
x: center.x - (_this.currentProperties.dimensions.z / 2),
y: center.y,
z: center.z - (_this.currentProperties.dimensions.z / 2)
};
upperCorner = {
var upperCorner = {
x: center.x + (_this.currentProperties.dimensions.z / 2),
y: center.y + _this.currentProperties.dimensions.y,
z: center.z + (_this.currentProperties.dimensions.z / 2)
};
var fish = [];
for (var i = 0; i < howMany; i++) {
@ -647,7 +656,12 @@
red: 0,
green: 255,
blue: 255
}
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
})
);
@ -662,6 +676,24 @@
})
function getOffsetFromTankCenter(VERTICAL_OFFSET, FORWARD_OFFSET, LATERAL_OFFSET) {
var tankProperties = Entities.getEntityProperties(_this.entityID);
var upVector = Quat.getUp(tankProperties.rotation);
var frontVector = Quat.getFront(tankProperties.rotation);
var rightVector = Quat.getRight(tankProperties.rotation);
var upOffset = Vec3.multiply(upVector, VERTICAL_OFFSET);
var frontOffset = Vec3.multiply(frontVector, FORWARD_OFFSET);
var rightOffset = Vec3.multiply(rightVector, LATERAL_OFFSET);
var finalOffset = Vec3.sum(tankProperties.position, upOffset);
finalOffset = Vec3.sum(finalOffset, frontOffset);
finalOffset = Vec3.sum(finalOffset, rightOffset);
return finalOffset
}
function setEntityUserData(id, data) {
var json = JSON.stringify(data)
Entities.editEntity(id, {
@ -706,4 +738,4 @@
}
return new FishTank();
});
});

View file

@ -11,6 +11,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var TANK_SCRIPT = Script.resolvePath('tank.js?' + Math.random());
FishTank = function(spawnPosition, spawnRotation) {
@ -38,8 +40,6 @@ FishTank = function(spawnPosition, spawnRotation) {
var TANK_POSITION = spawnPosition;
var TANK_MODEL_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/fishTank/aquariumTank.fbx";
var TANK_BASE_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/fishTank/aquariumBase.fbx';
@ -105,6 +105,13 @@ FishTank = function(spawnPosition, spawnRotation) {
z: 0.1020
}
var LOWER_CORNER_VERTICAL_OFFSET = -TANK_DIMENSIONS.y / 2;
var LOWER_CORNER_FORWARD_OFFSET = TANK_DIMENSIONS.x;
var LOWER_CORNER_LATERAL_OFFSET = -TANK_DIMENSIONS.z / 8;
var UPPER_CORNER_VERTICAL_OFFSET = TANK_DIMENSIONS.y / 2;;
var UPPER_CORNER_FORWARD_OFFSET = -TANK_DIMENSIONS.x;
var UPPER_CORNER_LATERAL_OFFSET = TANK_DIMENSIONS.z / 8;
function createFishTank() {
var tankProperties = {
@ -113,6 +120,7 @@ FishTank = function(spawnPosition, spawnRotation) {
modelURL: TANK_MODEL_URL,
dimensions: TANK_DIMENSIONS,
position: TANK_POSITION,
rotation: spawnRotation,
color: DEBUG_COLOR,
collisionless: true,
script: TANK_SCRIPT,
@ -120,7 +128,7 @@ FishTank = function(spawnPosition, spawnRotation) {
}
if (spawnRotation !== undefined) {
tankProperties.rotation = spawnRotation
tankProperties.rotation = Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z)
}
fishTank = Entities.addEntity(tankProperties);
@ -171,13 +179,20 @@ FishTank = function(spawnPosition, spawnRotation) {
"alphaStart": 0.3,
"alphaFinish": 0,
"emitterShouldTrail": 0,
"textures": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/fishTank/bubble-white.png"
"textures": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/fishTank/bubble-white.png",
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
bubbleProperties.type = "ParticleEffect";
bubbleProperties.parentID = fishTank;
bubbleProperties.dimensions = BUBBLE_SYSTEM_DIMENSIONS;
var finalOffset = getOffsetFromTankCenter(BUBBLE_SYSTEM_VERTICAL_OFFSET, BUBBLE_SYSTEM_FORWARD_OFFSET, BUBBLE_SYSTEM_LATERAL_OFFSET);
bubbleProperties.position = finalOffset;
@ -189,7 +204,7 @@ FishTank = function(spawnPosition, spawnRotation) {
bubbleProperties.position.x += -0.076;
thirdBubbleSystem = Entities.addEntity(bubbleProperties)
createBubbleSound(finalOffset);
// createBubbleSound(finalOffset);
}
function getOffsetFromTankCenter(VERTICAL_OFFSET, FORWARD_OFFSET, LATERAL_OFFSET) {
@ -238,7 +253,12 @@ FishTank = function(spawnPosition, spawnRotation) {
position: tankProperties.position,
visible: false,
collisionless: true,
dynamic: false
dynamic: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
innerContainer = Entities.addEntity(containerProps);
@ -246,7 +266,6 @@ FishTank = function(spawnPosition, spawnRotation) {
function createEntitiesAtCorners() {
var bounds = Entities.getEntityProperties(innerContainer, "boundingBox").boundingBox;
var lowerProps = {
name: 'hifi-home-fishtank-lower-corner',
@ -263,8 +282,13 @@ FishTank = function(spawnPosition, spawnRotation) {
blue: 0
},
collisionless: true,
position: bounds.brn,
visible: false
position: getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET),
visible: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
var upperProps = {
@ -282,8 +306,13 @@ FishTank = function(spawnPosition, spawnRotation) {
blue: 0
},
collisionless: true,
position: bounds.tfl,
visible: false
position: getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET),
visible: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
lowerCorner = Entities.addEntity(lowerProps);
@ -300,7 +329,12 @@ FishTank = function(spawnPosition, spawnRotation) {
parentID: fishTank,
modelURL: ROCK_MODEL_URL,
position: finalPosition,
dimensions: ROCK_DIMENSIONS
dimensions: ROCK_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
rocks = Entities.addEntity(properties);
@ -316,7 +350,12 @@ FishTank = function(spawnPosition, spawnRotation) {
modelURL: URCHIN_MODEL_URL,
position: finalPosition,
shapeType: 'Sphere',
dimensions: URCHIN_DIMENSIONS
dimensions: URCHIN_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
urchin = Entities.addEntity(properties);
@ -333,7 +372,12 @@ FishTank = function(spawnPosition, spawnRotation) {
modelURL: TREASURE_MODEL_URL,
position: finalPosition,
dimensions: TREASURE_DIMENSIONS,
rotation: Quat.fromPitchYawRollDegrees(10, -45, 10)
rotation: Quat.fromPitchYawRollDegrees(10, -45, 10),
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
treasure = Entities.addEntity(properties);
@ -352,7 +396,12 @@ FishTank = function(spawnPosition, spawnRotation) {
y: TANK_POSITION.y - BASE_VERTICAL_OFFSET,
z: TANK_POSITION.z
},
dimensions: TANK_BASE_DIMENSIONS
dimensions: TANK_BASE_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
tankBase = Entities.addEntity(properties);
@ -373,27 +422,29 @@ FishTank = function(spawnPosition, spawnRotation) {
createTankBase();
createTreasureChest();
var customKey = 'hifi-home-fishtank';
var customKey = 'hifi-home-fishtank';
var data = {
fishLoaded: false,
bubbleSystem: bubbleSystem,
bubbleSound: bubbleSound,
corners: {
brn: lowerCorner,
tfl: upperCorner
},
innerContainer: innerContainer,
}
var resetKey = 'hifiHomeKey';
var resetData = {
'reset': true
};
Script.setTimeout(function() {
setEntityCustomData(customKey, fishTank, data);
setEntityCustomData(resetKey, fishTank, resetData);
}, 2000)
function cleanup() {
print('TANK CLEANUP!')
Entities.deleteEntity(fishTank);
Entities.deleteEntity(tankBase);
Entities.deleteEntity(bubbleSystem);
@ -404,8 +455,8 @@ FishTank = function(spawnPosition, spawnRotation) {
Entities.deleteEntity(upperCorner);
Entities.deleteEntity(urchin);
Entities.deleteEntity(rocks);
bubbleInjector.stop();
bubbleInjector = null;
// bubbleInjector.stop();
// bubbleInjector = null;
}
@ -453,5 +504,5 @@ FishTank = function(spawnPosition, spawnRotation) {
}
this.cleanup = cleanup;
return this;
print('CREATED FISH!');
}

View file

@ -12,7 +12,7 @@
(function() {
Script.include('../../../../libraries/utils.js');
Script.include('../utils.js');
var _this;
@ -105,7 +105,11 @@
hslColor: Math.random() < 0.5 ? _this.flowerHSLColors[0] : _this.flowerHSLColors[1],
growthRate: growthRate
};
flower.userData = {
'hifiHomeKey': {
'reset': true
}
ProceduralEntity: {
shaderUrl: _this.SHADER_URL,
uniforms: {

View file

@ -12,9 +12,10 @@
(function() {
Script.include('../../../../libraries/utils.js');
Script.include('../utils.js');
var _this;
function WaterSpout() {
_this = this;
_this.waterSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/shower.wav");
@ -58,7 +59,7 @@
_this.waterPouring = false;
//water no longer pouring...
if (_this.waterInjector) {
_this.waterInjector.stop();
_this.waterInjector.stop();
}
Entities.callEntityMethod(_this.mostRecentIntersectedGrowableEntity, 'stopWatering');
},
@ -187,6 +188,11 @@
alphaFinish: 1.0,
emitterShouldTrail: true,
textures: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/raindrop.png",
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
},

View file

@ -8,6 +8,7 @@
// This entity script handles the logic for growing a plant when it has water poured on it
// 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());
Plant = function(spawnPosition, spawnRotation) {
@ -31,7 +32,12 @@ Plant = function(spawnPosition, spawnRotation) {
modelURL: BOWL_MODEL_URL,
dimensions: bowlDimensions,
name: "plant bowl",
position: bowlPosition
position: bowlPosition,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
@ -54,9 +60,15 @@ Plant = function(spawnPosition, spawnRotation) {
dimensions: plantDimensions,
position: plantPosition,
script: PLANT_SCRIPT_URL,
parentID: bowl
parentID: bowl,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
var WATER_CAN_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/waterCan.fbx?v1" + Math.random();
var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation)));
@ -82,6 +94,9 @@ Plant = function(spawnPosition, spawnRotation) {
},
rotation: waterCanRotation,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
wearable: {
joints: {
RightHand: [{
@ -128,10 +143,16 @@ Plant = function(spawnPosition, spawnRotation) {
position: waterSpoutPosition,
rotation: waterSpoutRotation,
parentID: waterCan,
visible: false
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
function cleanup() {
print('PLANT CLEANUP!')
Entities.deleteEntity(plant);
Entities.deleteEntity(bowl);
Entities.deleteEntity(waterCan);
@ -140,4 +161,7 @@ Plant = function(spawnPosition, spawnRotation) {
this.cleanup = cleanup;
print('CREATED PLANT:: ' + plant)
}

View file

@ -0,0 +1,296 @@
{
"Entities": [{
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.25794500112533569,
"y": 0.3533988893032074,
"z": 0.03479468822479248
},
"dynamic": 1,
"id": "{896373aa-9ed0-4be5-865b-a474448ea67b}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-SC-NS.fbx",
"name": "home_model_book1",
"position": {
"x": 0,
"y": 0.0357666015625,
"z": 0
},
"queryAACube": {
"scale": 0.43890440464019775,
"x": -0.21945220232009888,
"y": -0.18368560075759888,
"z": -0.21945220232009888
},
"rotation": {
"w": -0.31764703989028931,
"x": -4.57763671875e-05,
"y": 0.94818031787872314,
"z": -1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.25794500112533569,
"y": 0.36685666441917419,
"z": 0.046798638999462128
},
"dynamic": 1,
"id": "{e48fd6a5-ff0f-4ba6-92c7-fd972eba53c6}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-RPO-EC.fbx",
"name": "home_model_book_readyplayerone",
"position": {
"x": 0.031494140625,
"y": 0.052947998046875,
"z": 0.04192352294921875
},
"queryAACube": {
"scale": 0.45089861750602722,
"x": -0.19395516812801361,
"y": -0.17250131070613861,
"z": -0.18352578580379486
},
"rotation": {
"w": -0.2843213677406311,
"x": -4.57763671875e-05,
"y": 0.95870912075042725,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.23445942997932434,
"y": 0.33540505170822144,
"z": 0.036211937665939331
},
"id": "{e0790afc-6c62-4891-a933-7904b6cbc7cc}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-DADOES-PD.fbx",
"name": "home_model_book_DoAndroids",
"position": {
"x": 0.031005859375,
"y": 0.0430908203125,
"z": 0.10480499267578125
},
"dynamic": 1,
"queryAACube": {
"scale": 0.41082730889320374,
"x": -0.17440779507160187,
"y": -0.16232283413410187,
"z": -0.10060866177082062
},
"rotation": {
"w": -0.2843824028968811,
"x": -4.57763671875e-05,
"y": 0.95870912075042725,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.19239270687103271,
"y": 0.27543020248413086,
"z": 0.042817402631044388
},
"id": "{5120bfbb-66bf-493c-8c1a-ed883f39c054}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-F1-IA.fbx",
"name": "home_model_book_Foundation1",
"position": {
"x": 0.04150390625,
"y": 0.005096435546875,
"z": 0.15532684326171875
},
"dynamic": 1,
"queryAACube": {
"scale": 0.33868876099586487,
"x": -0.12784047424793243,
"y": -0.16424794495105743,
"z": -0.014017537236213684
},
"rotation": {
"w": -0.2843213677406311,
"x": -4.57763671875e-05,
"y": 0.95870912075042725,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.19239270687103271,
"y": 0.27289187908172607,
"z": 0.037494994699954987
},
"id": "{f9af3a1e-dbd5-4fb3-ad38-dc818592e4c6}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-F2-IA.fbx",
"position": {
"x": 0.056884765625,
"y": 0.00262451171875,
"z": 0.20074462890625
},
"dynamic": 1,
"queryAACube": {
"scale": 0.33599227666854858,
"x": -0.11111137270927429,
"y": -0.16537162661552429,
"z": 0.032748490571975708
},
"rotation": {
"w": -0.2843213677406311,
"x": -4.57763671875e-05,
"y": 0.95870912075042725,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.19239270687103271,
"y": 0.27362632751464844,
"z": 0.04995863139629364
},
"id": "{6af6bf06-05c9-427c-8ff5-d10072ffc293}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-F3-IA.fbx",
"name": "home_model_book_Foundation3",
"position": {
"x": 0.0919189453125,
"y": 0,
"z": 0.24033355712890625
},
"dynamic": 1,
"queryAACube": {
"scale": 0.33820435404777527,
"x": -0.077183231711387634,
"y": -0.16910217702388763,
"z": 0.071231380105018616
},
"rotation": {
"w": -0.2843213677406311,
"x": -4.57763671875e-05,
"y": 0.95870912075042725,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.20406116545200348,
"y": 0.29261711239814758,
"z": 0.014823859557509422
},
"id": "{4982da58-d573-4582-b627-f08312cc0d07}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-LPP-ASE.fbx",
"position": {
"x": 0.1171875,
"y": 0.01153564453125,
"z": 0.26572418212890625
},
"dynamic": 1,
"queryAACube": {
"scale": 0.35705110430717468,
"x": -0.061338052153587341,
"y": -0.16698990762233734,
"z": 0.087198629975318909
},
"rotation": {
"w": -0.27602046728134155,
"x": -4.57763671875e-05,
"y": 0.96115052700042725,
"z": -1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}, {
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionSoundURL": "http://hifi-content.s3.amazonaws.com/DomainContent/Home/Sounds/book_fall.L.wav",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.23497477173805237,
"y": 0.28377044200897217,
"z": 0.033324316143989563
},
"id": "{178b1cef-f76b-4cda-b834-42080208d502}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Book-N-WG.fbx",
"position": {
"x": 0.1429443359375,
"y": 0.00970458984375,
"z": 0.2823486328125
},
"dynamic": 1,
"queryAACube": {
"scale": 0.36993148922920227,
"x": -0.042021408677101135,
"y": -0.17526115477085114,
"z": 0.097382888197898865
},
"rotation": {
"w": -0.30934613943099976,
"x": -4.57763671875e-05,
"y": 0.9509575366973877,
"z": -1.52587890625e-05
},
"shapeType": "box",
"type": "Model"
}],
"Version": 57
}

View file

@ -0,0 +1,35 @@
{
"Entities": [{
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/simple-chair2.obj",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 0.66077238321304321,
"y": 1.058124303817749,
"z": 0.7188611626625061
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -6,
"z": 0
},
"id": "{d97c8a4e-9b95-448c-a729-5da9e22b6adc}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/simple-chair2.fbx",
"queryAACube": {
"scale": 1.439794659614563,
"x": -0.71989732980728149,
"y": -0.71989732980728149,
"z": -0.71989732980728149
},
"rotation": {
"w": 0.63176929950714111,
"x": -0.0003204345703125,
"y": 0.77511250972747803,
"z": 0.0002593994140625
},
"shapeType": "compound",
"type": "Model"
}],
"Version": 57
}

View file

@ -0,0 +1,269 @@
{
"Entities": [{
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Bowl.obj",
"created": "2016-03-15T23:11:03Z",
"dimensions": {
"x": 0.35241550207138062,
"y": 0.08979363739490509,
"z": 0.35241544246673584
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
"id": "{fa981882-c38f-4413-88f2-255a06aacf08}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Bowl.fbx",
"position": {
"x": 0.1168212890625,
"y": 0,
"z": 0.11590576171875
},
"queryAACube": {
"scale": 0.50641506910324097,
"x": -0.13638624548912048,
"y": -0.25320753455162048,
"z": -0.13730177283287048
},
"rotation": {
"w": 0.49941253662109375,
"x": -4.57763671875e-05,
"y": 0.86633098125457764,
"z": -0.0001068115234375
},
"shapeType": "compound",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.083729811012744904,
"y": 0.092105500400066376,
"z": 0.08111707866191864
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -9,
"z": 0
},
"id": "{ed04b516-3c66-42d9-99af-c4425765df27}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple-2.fbx",
"position": {
"x": 0.1728515625,
"y": 0.040313720703125,
"z": 0.08847808837890625
},
"queryAACube": {
"scale": 0.14857350289821625,
"x": 0.098564811050891876,
"y": -0.033973030745983124,
"z": 0.014191336929798126
},
"restitution": 0.33000001311302185,
"rotation": {
"w": 0.74630355834960938,
"x": -0.5419546365737915,
"y": 0.080125093460083008,
"z": -0.37801176309585571
},
"shapeType": "sphere",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.089192003011703491,
"y": 0.098114080727100372,
"z": 0.086408823728561401
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -8,
"z": 0
},
"id": "{031f883a-6d7f-447a-96b1-c3ea75f938e1}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple.fbx",
"position": {
"x": 0.146240234375,
"y": 0.083740234375,
"z": 0
},
"queryAACube": {
"scale": 0.15826581418514252,
"x": 0.067107327282428741,
"y": 0.0046073272824287415,
"z": -0.079132907092571259
},
"restitution": 0.30000001192092896,
"rotation": {
"w": -0.2233462929725647,
"x": 0.81002521514892578,
"y": -0.071244359016418457,
"z": 0.5374685525894165
},
"shapeType": "sphere",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-16T00:27:30Z",
"dimensions": {
"x": 0.083729811012744904,
"y": 0.092105500400066376,
"z": 0.08111707866191864
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -9,
"z": 0
},
"id": "{e3d77c1e-1fcf-4dc2-8799-001046934df8}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple-2.fbx",
"position": {
"x": 0.08203125,
"y": 0.042266845703125,
"z": 0.05945587158203125
},
"queryAACube": {
"scale": 0.14857350289821625,
"x": 0.0077444985508918762,
"y": -0.032019905745983124,
"z": -0.014830879867076874
},
"restitution": 0.33000001311302185,
"rotation": {
"w": 0.82665753364562988,
"x": -0.32744336128234863,
"y": 0.10566878318786621,
"z": 0.44527351856231689
},
"shapeType": "sphere",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-16T00:27:30Z",
"dimensions": {
"x": 0.089192003011703491,
"y": 0.098114080727100372,
"z": 0.086408823728561401
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -8,
"z": 0
},
"id": "{34c224cf-d5f5-4cf3-9bf6-55857bf08e43}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple.fbx",
"position": {
"x": 0,
"y": 0.082916259765625,
"z": 0.0829925537109375
},
"queryAACube": {
"scale": 0.15826581418514252,
"x": -0.079132907092571259,
"y": 0.0037833526730537415,
"z": 0.0038596466183662415
},
"restitution": 0.30000001192092896,
"rotation": {
"w": 0.075150728225708008,
"x": 0.60289919376373291,
"y": 0.78295564651489258,
"z": -0.13344013690948486
},
"shapeType": "sphere",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-16T00:27:30Z",
"dimensions": {
"x": 0.083729811012744904,
"y": 0.092105500400066376,
"z": 0.08111707866191864
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -9,
"z": 0
},
"id": "{0eab5380-2358-4bcd-b53e-a071d50e1475}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple-2.fbx",
"position": {
"x": 0.0596923828125,
"y": 0.04351806640625,
"z": 0.15406036376953125
},
"queryAACube": {
"scale": 0.14857350289821625,
"x": -0.014594368636608124,
"y": -0.030768685042858124,
"z": 0.079773612320423126
},
"restitution": 0.33000001311302185,
"rotation": {
"w": -0.047714948654174805,
"x": 0.91860842704772949,
"y": -0.33046466112136841,
"z": -0.21126115322113037
},
"shapeType": "sphere",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"collisionsWillMove": 1,
"created": "2016-03-16T00:27:30Z",
"dimensions": {
"x": 0.089192003011703491,
"y": 0.098114080727100372,
"z": 0.086408823728561401
},
"dynamic": 1,
"friction": 0.33000001311302185,
"gravity": {
"x": 0,
"y": -8,
"z": 0
},
"id": "{c8140643-23fb-4827-b708-e87103f9e438}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Fruit-Apple.fbx",
"position": {
"x": 0.1519775390625,
"y": 0.046356201171875,
"z": 0.16817474365234375
},
"queryAACube": {
"scale": 0.15826581418514252,
"x": 0.072844631969928741,
"y": -0.032776705920696259,
"z": 0.089041836559772491
},
"restitution": 0.30000001192092896,
"rotation": {
"w": 0.59276723861694336,
"x": 0.56038761138916016,
"y": 0.10734724998474121,
"z": -0.56835281848907471
},
"shapeType": "sphere",
"type": "Model"
}],
"Version": 57
}

View file

@ -0,0 +1,35 @@
{
"Entities": [{
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Little-Lamp.obj",
"created": "2016-03-16T01:00:16Z",
"dimensions": {
"x": 0.63867169618606567,
"y": 0.75600343942642212,
"z": 0.22696791589260101
},
"id": "{533c2da8-ea8c-4ae8-9c1c-3a18c7d91f46}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Little-Lamp-White-4.fbx",
"position": {
"x": 1103.28564453125,
"y": 460.89242553710938,
"z": 0
},
"dynamic": 1,
"queryAACube": {
"scale": 1.0153605937957764,
"x": 1102.7779541015625,
"y": 460.38473510742188,
"z": -0.50768029689788818
},
"rotation": {
"w": -0.36089110374450684,
"x": -0.014938592910766602,
"y": -0.93249410390853882,
"z": -0.0007476806640625
},
"shapeType": "compound",
"type": "Model",
}],
"Version": 57
}

View file

@ -0,0 +1,35 @@
{
"Entities": [{
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/desk-drawer-1.obj",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.87835502624511719,
"y": 0.32454308867454529,
"z": 0.71838575601577759
},
"gravity": {
"x": 0,
"y": -1,
"z": 0
},
"dynamic": 1,
"id": "{a87cc972-aaf5-48a4-b720-d79ee7bd68d9}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/desk-drawer-1.fbx",
"queryAACube": {
"scale": 1.1802177429199219,
"x": -0.59010887145996094,
"y": -0.59010887145996094,
"z": -0.59010887145996094
},
"rotation": {
"w": 0.9542534351348877,
"x": -4.57763671875e-05,
"y": 0.29893946647644043,
"z": -1.52587890625e-05
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,35 @@
{
"Entities": [{
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Little-Lamp.obj",
"created": "2016-03-16T01:04:38Z",
"dimensions": {
"x": 0.63867169618606567,
"y": 0.75600343942642212,
"z": 0.22696791589260101
},
"id": "{ee167d6d-3901-469a-86df-baf787691997}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Little-Lamp-White-4.fbx",
"position": {
"x": 1104.701171875,
"y": 460.98452758789062,
"z": 0
},
"dynamic": 1,
"queryAACube": {
"scale": 1.0153605937957764,
"x": 1104.1934814453125,
"y": 460.47683715820312,
"z": -0.50768029689788818
},
"rotation": {
"w": 0.69259178638458252,
"x": -0.0070344209671020508,
"y": -0.72118711471557617,
"z": 0.013168573379516602
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,32 @@
{
"Entities": [{
"created": "2016-03-07T21:07:29Z",
"dimensions": {
"x": 2.0069153308868408,
"y": 0.0160951167345047,
"z": 0.45006880164146423
},
"gravity": {
"x": 0,
"y": -2,
"z": 0
},
"dynamic": 1,
"id": "{9745b51e-7816-4de0-85d0-82432a0b8175}",
"queryAACube": {
"scale": 2.0568251609802246,
"x": -1.0284125804901123,
"y": -1.0284125804901123,
"z": -1.0284125804901123
},
"rotation": {
"w": -0.0063019990921020508,
"x": 0.46935224533081055,
"y": -0.011947810649871826,
"z": -0.88293278217315674
},
"type": "Box",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,35 @@
{
"Entities": [{
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/desk-drawer-2.obj",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.8697468638420105,
"y": 0.31825172901153564,
"z": 1.1220188140869141
},
"gravity": {
"x": 0,
"y": -1,
"z": 0
},
"dynamic": 1,
"id": "{ae1fa8dd-1167-40c1-8fa7-aeb12ee7b12c}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/desk-drawer-2.fbx",
"queryAACube": {
"scale": 1.4548780918121338,
"x": -0.72743904590606689,
"y": -0.72743904590606689,
"z": -0.72743904590606689
},
"rotation": {
"w": 0.9539787769317627,
"x": -7.62939453125e-05,
"y": 0.29982447624206543,
"z": -1.52587890625e-05
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,38 @@
{
"Entities": [
{
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Trash-Can-4.obj",
"created": "2016-03-15T23:06:41Z",
"dimensions": {
"x": 0.4264354407787323,
"y": 0.50489801168441772,
"z": 0.42643532156944275
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -5,
"z": 0
},
"id": "{e9693784-4264-4dd5-baa7-fd165b2645c8}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Trach-Can-3.fbx",
"queryAACube": {
"scale": 0.78652161359786987,
"x": -0.39326080679893494,
"y": -0.39326080679893494,
"z": -0.39326080679893494
},
"rotation": {
"w": -0.46858930587768555,
"x": 7.62939453125e-05,
"y": 0.88342106342315674,
"z": -4.57763671875e-05
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}
],
"Version": 57
}

View file

@ -0,0 +1,32 @@
{
"Entities": [{
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 2.0069153308868408,
"y": 0.0160951167345047,
"z": 0.45006880164146423
},
"gravity": {
"x": 0,
"y": -1,
"z": 0
},
"dynamic": 1,
"id": "{ef35ce2a-fddb-44bf-bb1b-30d9fac70563}",
"queryAACube": {
"scale": 2.0568251609802246,
"x": -1.0284125804901123,
"y": -1.0284125804901123,
"z": -1.0284125804901123
},
"rotation": {
"w": -0.0064851045608520508,
"x": 0.46929121017456055,
"y": -0.012191951274871826,
"z": -0.88293278217315674
},
"type": "Box",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,252 @@
print('KINETIC INCLUDING WRAPPER')
var BOOKS_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/books.json' + "?" + Math.random();
var UPPER_BOOKSHELF_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/upperBookShelf.json' + "?" + Math.random();
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 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/labLamp.json' + "?" + Math.random();
var LIVING_ROOM_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/livingRoomLamp.json' + "?" + Math.random();
var TRASHCAN_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/trashcan.json' + "?" + Math.random();
FruitBowl = function(spawnLocation, spawnRotation) {
print('CREATE FRUIT BOWL')
var created = [];
function create() {
var success = Clipboard.importEntities(FRUIT_BOWL_URL);
if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
LabLamp = function(spawnLocation, spawnRotation) {
print('CREATE LAB LAMP')
var created = [];
function create() {
var success = Clipboard.importEntities(LAB_LAMP_URL);
if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
LivingRoomLamp = function(spawnLocation, spawnRotation) {
print('CREATE LIVING ROOM LAMP')
var created = [];
function create() {
var success = Clipboard.importEntities(LIVING_ROOM_LAMP_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
UpperBookShelf = function(spawnLocation, spawnRotation) {
print('CREATE UPPER SHELF')
var created = [];
function create() {
var success = Clipboard.importEntities(UPPER_BOOKSHELF_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
LowerBookShelf = function(spawnLocation, spawnRotation) {
print('CREATE LOWER SHELF')
var created = [];
function create() {
var success = Clipboard.importEntities(LOWER_BOOKSHELF_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
RightDeskDrawer = function(spawnLocation, spawnRotation) {
print('CREATE RIGHT DRAWER')
var created = [];
function create() {
var success = Clipboard.importEntities(RIGHT_DESK_DRAWER_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
LeftDeskDrawer = function(spawnLocation, spawnRotation) {
print('CREATE LEFT DRAWER')
var created = [];
function create() {
var success = Clipboard.importEntities(LEFT_DESK_DRAWER_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
Chair = function(spawnLocation, spawnRotation) {
print('CREATE CHAIR')
var created = [];
function create() {
var success = Clipboard.importEntities(CHAIR_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
Trashcan = function(spawnLocation, spawnRotation) {
print('CREATE TRASHCAN')
var created = [];
function create() {
var success = Clipboard.importEntities(TRASHCAN_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
Books = function(spawnLocation, spawnRotation) {
print('CREATE BOOKS')
var created = [];
function create() {
var success = Clipboard.importEntities(BOOKS_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}

View file

@ -0,0 +1,163 @@
// pingPongGun.js
//
// Script Type: Entity
// Created by James B. Pollack @imgntn on 9/21/2015
// Copyright 2015 High Fidelity, Inc.
//
// This script shoots a ping pong ball.
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
(function() {
Script.include("../utils.js");
var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav';
var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx';
function PingPongGun() {
return;
}
//if the trigger value goes below this value, reload the gun.
var RELOAD_THRESHOLD = 0.95;
var GUN_TIP_FWD_OFFSET = -0.35;
var GUN_TIP_UP_OFFSET = 0.12;
var GUN_FORCE = 9;
var BALL_RESTITUTION = 0.6;
var BALL_LINEAR_DAMPING = 0.4;
var BALL_GRAVITY = {
x: 0,
y: -4.8,
z: 0
};
var PING_PONG_GUN_GRAVITY = {
x: 0,
y: -5,
z: 0
};
var BALL_DIMENSIONS = {
x: 0.04,
y: 0.04,
z: 0.04
};
var BALL_COLOR = {
red: 255,
green: 255,
blue: 255
};
var TRIGGER_CONTROLS = [
Controller.Standard.LT,
Controller.Standard.RT,
];
PingPongGun.prototype = {
hand: null,
gunTipPosition: null,
canShoot: false,
canShootTimeout: null,
startEquip: function(entityID, args) {
this.hand = args[0] == "left" ? 0 : 1;
},
continueEquip: function(entityID, args) {
if (this.canShootTimeout !== null) {
Script.clearTimeout(this.canShootTimeout);
}
this.checkTriggerPressure(this.hand);
},
releaseEquip: function(entityID, args) {
var _this = this;
this.canShootTimeout = Script.setTimeout(function() {
_this.canShoot = false;
}, 250);
},
checkTriggerPressure: function(gunHand) {
this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[gunHand]);
if (this.triggerValue < RELOAD_THRESHOLD) {
// print('RELOAD');
this.canShoot = true;
} else if (this.triggerValue >= RELOAD_THRESHOLD && this.canShoot === true) {
var gunProperties = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
this.shootBall(gunProperties);
this.canShoot = false;
}
return;
},
shootBall: function(gunProperties) {
var forwardVec = Quat.getFront(Quat.multiply(gunProperties.rotation, Quat.fromPitchYawRollDegrees(0, 180, 0)));
forwardVec = Vec3.normalize(forwardVec);
forwardVec = Vec3.multiply(forwardVec, GUN_FORCE);
var properties = {
// type: 'Model',
// modelURL:PING_PONG_BALL_URL,
shapeType: 'sphere',
type: 'Sphere',
color: BALL_COLOR,
dimensions: BALL_DIMENSIONS,
damping: BALL_LINEAR_DAMPING,
gravity: BALL_GRAVITY,
restitution: BALL_RESTITUTION,
dynamic: true,
rotation: gunProperties.rotation,
position: this.getGunTipPosition(gunProperties),
gravity:PING_PONG_GUN_GRAVITY,
velocity: forwardVec,
lifetime: 10,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
Entities.addEntity(properties);
this.playSoundAtCurrentPosition(gunProperties.position);
},
playSoundAtCurrentPosition: function(position) {
var audioProperties = {
volume: 0.2,
position: position
};
Audio.playSound(this.SHOOTING_SOUND, audioProperties);
},
getGunTipPosition: function(properties) {
//the tip of the gun is going to be in a different place than the center, so we move in space relative to the model to find that position
var frontVector = Quat.getFront(properties.rotation);
var frontOffset = Vec3.multiply(frontVector, GUN_TIP_FWD_OFFSET);
var upVector = Quat.getUp(properties.rotation);
var upOffset = Vec3.multiply(upVector, GUN_TIP_UP_OFFSET);
var gunTipPosition = Vec3.sum(properties.position, frontOffset);
gunTipPosition = Vec3.sum(gunTipPosition, upOffset);
return gunTipPosition;
},
preload: function(entityID) {
this.entityID = entityID;
this.SHOOTING_SOUND = SoundCache.getSound(SHOOTING_SOUND_URL);
}
};
// entity scripts always need to return a newly constructed object of our type
return new PingPongGun();
});

View file

@ -0,0 +1,77 @@
// createPingPongGun.js
//
// Script Type: Entity Spawner
// Created by James B. Pollack on 9/30/2015
// Copyright 2015 High Fidelity, Inc.
//
// This script creates a gun that shoots ping pong balls when you pull the trigger on a hand controller.
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
Script.include("../utils.js");
var scriptURL = Script.resolvePath('pingPongGun.js');
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
_PingPongGun = function(spawnPosition, spawnRotation) {
var pingPongGun = Entities.addEntity({
type: "Model",
modelURL: MODEL_URL,
shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL,
script: scriptURL,
position: spawnPosition,
dimensions: {
x: 0.125,
y: 0.3875,
z: 0.9931
},
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
dynamic: true,
collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
},
'hifiHomeKey': {
'reset': true
},
wearable: {
joints: {
RightHand: [{
x: 0.1177130937576294,
y: 0.12922893464565277,
z: 0.08307232707738876
}, {
x: 0.4934672713279724,
y: 0.3605862259864807,
z: 0.6394805908203125,
w: -0.4664038419723511
}],
LeftHand: [{
x: 0.09151676297187805,
y: 0.13639454543590546,
z: 0.09354984760284424
}, {
x: -0.19628101587295532,
y: 0.6418180465698242,
z: 0.2830369472503662,
w: 0.6851521730422974
}]
}
}
})
});
function cleanup() {
print('PING PONG CLEANUP!')
Entities.deleteEntity(pingPongGun);
}
this.cleanup = cleanup;
print('CREATED PING PONG GUN')
}

View file

@ -14,11 +14,9 @@
(function() {
var _this;
var dynamicEntities = [];
function Reset() {
_this = this;
};
}
var utilsPath = Script.resolvePath('utils.js');
@ -32,6 +30,13 @@
var cuckooClockPath = Script.resolvePath("cuckooClock/wrapper.js?" + Math.random());
var pingPongGunPath = Script.resolvePath("pingPongGun/wrapper.js?" + Math.random());
var kineticPath = Script.resolvePath("kineticObjects/wrapper.js?" + Math.random());
Script.include(kineticPath);
Script.include(utilsPath);
Script.include(fishTankPath);
Script.include(tiltMazePath);
@ -39,14 +44,21 @@
Script.include(plantPath);
Script.include(cuckooClockPath);
Script.include(pingPongGunPath);
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,
y: 0.5,
z: 0
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
Reset.prototype = {
tidying: false,
preload: function(entityID) {
_this.entityID = entityID;
},
unload: function() {
this.cleanupDynamicEntities();
},
tidying: false,
showTidyingButton: function() {
var textureString =
'Texture.001:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Head-Housing-Texture.png",\ntex.face.screen.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face-Emit.png",\ntex.face.sceen:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face.png",\ntex.button.blanks:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks.png",\ntex.button.blanks.normal:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks-Normal.png",\nbutton.tidy.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidy-Up-Button-Orange-Emit.png",\nbutton.tidy:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidy-Up-Button-Orange.png"'
@ -55,6 +67,7 @@
textures: textureString
});
},
showTidyButton: function() {
var textureString =
'Texture.001:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Head-Housing-Texture.png",\ntex.face.screen.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face-Emit.png",\ntex.face.sceen:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face.png",\ntex.button.blanks:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks.png",\ntex.button.blanks.normal:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks-Normal.png",\nbutton.tidy.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Tidy-Up-Button-Green-Emit.png",\nbutton.tidy:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Tidy-Up-Button-Green.png"'
@ -63,9 +76,11 @@
textures: textureString
});
},
playTidyingSound: function() {
},
toggleButton: function() {
if (_this.tidying === true) {
return;
@ -73,12 +88,19 @@
_this.tidying = true;
_this.showTidyingButton();
_this.playTidyingSound();
_this.findAndDeleteHomeEntities();
Script.setTimeout(function() {
_this.showTidyButton();
_this.tidying = false;
}, 2500);
_this.cleanupDynamicEntities();
_this.createDynamicEntities();
Script.setTimeout(function() {
_this.createKineticEntities();
_this.createDynamicEntities();
}, 750)
}
},
@ -95,23 +117,52 @@
},
createDynamicEntities: function() {
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,
y: 0.5,
z: 0
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
// var fishTank = new FishTank({
// x: 1098.9254,
// y: 460.5814,
// z: -79.1103
// }, {
// x: 0,
// y: 152,
// z: 0
// });
// var fishTank = new FishTank(center);
// var tiltMaze = new TiltMaze(center);
// var whiteboard = new Whiteboard(center);
// var myPlant = new Plant(center);
// dynamicEntities.push(fishTank);
// dynamicEntities.push(tiltMaze);
// dynamicEntities.push(whiteboard);
// dynamicEntities.push(myPlant);
// 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 myPlant = new Plant({
// x: 1099.8785,
// y: 460.3115,
// z: -84.7736
// });
// var pingPongGun = new _PingPongGun({
// x: 1101.2123,
// y: 460.2328,
// z: -65.8513
// }, {
// x: 97.3683,
// y: 179.0293,
// z: 89.9698
// });
//v2.0
// var musicBox = new MusicBox();
@ -119,6 +170,12 @@
// var doppelganger = new Doppelganger();
dynamicEntities.push(cuckooClock);
// dynamicEntities.push(fishTank);
// dynamicEntities.push(tiltMaze);
// dynamicEntities.push(whiteboard);
// dynamicEntities.push(myPlant);
},
cleanupDynamicEntities: function() {
@ -128,9 +185,97 @@
dynamicEntities.forEach(function(dynamicEntity) {
print('dynamicEntity is:: '+JSON.stringify(dynamicEntity))
dynamicEntity.cleanup();
})
});
},
createKineticEntities: function() {
var fruitBowl = new FruitBowl({
x: 1105.3185,
y: 460.3221,
z: -81.2452
});
var livingRoomLamp = new LivingRoomLamp({
x: 1104.6732,
y: 460.3326,
z: -81.9710
});
var upperBookShelf = new UpperBookShelf({
x: 1106.2649,
y: 461.5352,
z: -80.3018
});
var lowerBookShelf = new LowerBookShelf({
x: 1106.2725,
y: 460.9600,
z: -80.2837
});
var rightDeskDrawer = new RightDeskDrawer({
x: 1105.1735,
y: 460.0446,
z: -81.3612
});
var leftDeskDrawer = new LeftDeskDrawer({
x: 1104.6478,
y: 460.0463,
z: -82.1095
});
var chair = new Chair({
x: 1105.2716,
y: 459.7251,
z: -79.8097
});
var trashcan = new Trashcan({
x: 1103.9034,
y: 459.4355,
z: -82.3619
});
var books = new Books({
x: 1106.1553,
y: 461.1,
z: -80.4890
});
},
findAndDeleteHomeEntities: function() {
print('JBP trying to find home entities to delete')
var resetProperties = Entities.getEntityProperties(_this.entityID);
var results = Entities.findEntities(resetProperties.position, 1000);
var found = [];
results.forEach(function(result) {
var properties = Entities.getEntityProperties(result);
var userData = null;
try {
userData = JSON.parse(properties.userData);
} catch (err) {
// print('error parsing json');
// print('properties are:' + properties.userData);
return;
}
if (userData.hasOwnProperty('hifiHomeKey')) {
if (userData.hifiHomeKey.reset === true) {
Entities.deleteEntity(result);
}
}
})
print('JBP after deleting home entities')
},
unload: function() {
this.findAndDeleteHomeEntities();
}
}
return new Reset();
});

View file

@ -7,7 +7,7 @@
var DIFFUSE_TEXTURE_URL = "http://hifi-content.s3.amazonaws.com/highfidelity_diffusebaked.png";
var _this;
var utilitiesScript = Script.resolvePath('../../../../libraries/utils.js');
var utilitiesScript = Script.resolvePath('../utils.js');
Script.include(utilitiesScript);
Switch = function() {
_this = this;
@ -15,7 +15,7 @@
};
Switch.prototype = {
prefix: 'hifi-home-dressing-room-disc-light',
prefix: 'hifi-home-dressing-room-disc-',
clickReleaseOnEntity: function(entityID, mouseEvent) {
if (!mouseEvent.isLeftButton) {
return;
@ -27,16 +27,16 @@
this.toggleLights();
},
modelEmitOn: function(discModel) {
Entities.editEntity(glowDisc, {
textures: 'emissive:' + EMISSIVE_TEXTURE_URL ',\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
})
modelEmitOn: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'Metal-brushed-light.jpg:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Dressing-Room-3.fbx/Lights-Dressing-Room-3.fbm/Metal-brushed-light.jpg",\nTex.CeilingLight-Emit:"http://hifi-content.s3.amazonaws.com/alan/dev/Lights-Dressing-Room-3.fbx/Lights-Dressing-Room-3.fbm/CielingLight-On-Diffuse.jpg",\nTexCeilingLight.Diffuse:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Dressing-Room-3.fbx/Lights-Dressing-Room-3.fbm/CielingLight-Base.jpg"'
});
},
modelEmitOff: function(discModel) {
Entities.editEntity(glowDisc, {
textures: 'emissive:"",\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
})
modelEmitOff: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'Metal-brushed-light.jpg:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Dressing-Room-3.fbx/Lights-Dressing-Room-3.fbm/Metal-brushed-light.jpg",\nTex.CeilingLight-Emit:"",\nTexCeilingLight.Diffuse:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Dressing-Room-3.fbx/Lights-Dressing-Room-3.fbm/CielingLight-Base.jpg"'
});
},
masterLightOn: function(masterLight) {
@ -45,7 +45,7 @@
});
},
masterLightOff: function() {
masterLightOff: function(masterLight) {
Entities.editEntity(masterLight, {
visible: false
});
@ -96,20 +96,19 @@
found.push(result);
}
});
// Only one light for now
return found;
},
toggleLights: function() {
this.switch = getEntityCustomData('home-switch', this.entityID, {
state: 'off'
});
_this._switch = getEntityCustomData('home-switch', _this.entityID, {state: 'off'});
var glowLights = this.findGlowLights();
var masterLights = this.findMasterLights();
var emitModels = this.findEmitModels();
if (this.switch.state === 'off') {
if (this._switch.state === 'off') {
glowLights.forEach(function(glowLight) {
_this.glowLightOn(glowLight);
});
@ -119,7 +118,7 @@
emitModels.forEach(function(emitModel) {
_this.modelEmitOn(emitModel);
});
setEntityCustomData('home-switch', this.entityID, {
setEntityCustomData('home-switch', _this.entityID, {
state: 'on'
});

View file

@ -77,14 +77,14 @@
toggleLights: function() {
this.switch = getEntityCustomData('home-switch', this.entityID, {
this._switch = getEntityCustomData('home-switch', this.entityID, {
state: 'off'
});
var masterLights = this.findMasterLights();
var emitModels = this.findEmitModels();
if (this.switch.state === 'off') {
if (this._switch.state === 'off') {
masterLights.forEach(function(masterLight) {
_this.masterLightOn(masterLight);

View file

@ -77,14 +77,14 @@
toggleLights: function() {
this.switch = getEntityCustomData('home-switch', this.entityID, {
this._switch = getEntityCustomData('home-switch', this.entityID, {
state: 'off'
});
var masterLights = this.findMasterLights();
var emitModels = this.findEmitModels();
if (this.switch.state === 'off') {
if (this._switch.state === 'off') {
masterLights.forEach(function(masterLight) {
_this.masterLightOn(masterLight);

View file

@ -7,7 +7,7 @@
var DIFFUSE_TEXTURE_URL = "http://hifi-content.s3.amazonaws.com/highfidelity_diffusebaked.png";
var _this;
var utilitiesScript = Script.resolvePath('../../../../libraries/utils.js');
var utilitiesScript = Script.resolvePath('../utils.js');
Script.include(utilitiesScript);
Switch = function() {
_this = this;
@ -15,7 +15,7 @@
};
Switch.prototype = {
prefix: 'hifi-home-living-room-disc-light',
prefix: 'hifi-home-living-room-disc-',
clickReleaseOnEntity: function(entityID, mouseEvent) {
if (!mouseEvent.isLeftButton) {
return;
@ -27,15 +27,15 @@
this.toggleLights();
},
modelEmitOn: function(discModel) {
modelEmitOn: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'emissive:' + EMISSIVE_TEXTURE_URL ',\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
textures: 'Metal-brushed-light.jpg:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Living-Room-2.fbx/Lights-Living-Room-2.fbm/Metal-brushed-light.jpg",\nTex.CeilingLight.Emit:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Living-Room-2.fbx/Lights-Living-Room-2.fbm/CielingLight-On-Diffuse.jpg",\nTexCeilingLight.Diffuse:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Living-Room-2.fbx/Lights-Living-Room-2.fbm/CielingLight-Base.jpg"'
})
},
modelEmitOff: function(discModel) {
modelEmitOff: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'emissive:"",\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
textures: 'Metal-brushed-light.jpg:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Living-Room-2.fbx/Lights-Living-Room-2.fbm/Metal-brushed-light.jpg",\nTex.CeilingLight.Emit:"",\nTexCeilingLight.Diffuse:"https://s3-us-west-1.amazonaws.com/hifi-content/alan/dev/Lights-Living-Room-2.fbx/Lights-Living-Room-2.fbm/CielingLight-Base.jpg"'
})
},
@ -45,7 +45,7 @@
});
},
masterLightOff: function() {
masterLightOff: function(masterLight) {
Entities.editEntity(masterLight, {
visible: false
});
@ -101,7 +101,7 @@
toggleLights: function() {
this.switch = getEntityCustomData('home-switch', this.entityID, {
_this._switch = getEntityCustomData('home-switch', _this.entityID, {
state: 'off'
});
@ -109,7 +109,7 @@
var masterLights = this.findMasterLights();
var emitModels = this.findEmitModels();
if (this.switch.state === 'off') {
if (this._switch.state === 'off') {
glowLights.forEach(function(glowLight) {
_this.glowLightOn(glowLight);
});
@ -119,7 +119,7 @@
emitModels.forEach(function(emitModel) {
_this.modelEmitOn(emitModel);
});
setEntityCustomData('home-switch', this.entityID, {
setEntityCustomData('home-switch', _this.entityID, {
state: 'on'
});

View file

@ -9,7 +9,7 @@
};
Switch.prototype = {
prefix: 'hifi-home-living-room-fan',
prefix: 'hifi-home-living-room-',
clickReleaseOnEntity: function(entityID, mouseEvent) {
if (!mouseEvent.isLeftButton) {
return;
@ -22,24 +22,19 @@
},
fanRotationOn: function() {
Entities.editEntity(this.fan, {
damping: 0,
var success= Entities.editEntity(_this.fan, {
angularDamping: 0,
angularVelocity: {
x: 0,
y: 0.25,
y: 4,
z: 0
}
})
},
});
},
fanRotationOff: function() {
Entities.editEntity(this.fan, {
damping: 1.0,
// angularVelocity:{
// x:0,
// y:0,
// z:0
// }
Entities.editEntity(_this.fan, {
angularDamping: 0.5,
})
},
@ -64,20 +59,23 @@
var results = Entities.findEntities(this.position, SEARCH_RADIUS);
results.forEach(function(result) {
var properties = Entities.getEntityProperties(result);
if (properties.name === _this.prefix) {
if (properties.name === _this.prefix + "ceiling-fan") {
print("EBL FOUND FAN");
found.push(result);
}
});
return found;
return found[0];
},
toggle: function() {
this.fan = this.findFan();
this.switch = getEntityCustomData('home-switch', this.entityID, {
this._switch = getEntityCustomData('home-switch', this.entityID, {
state: 'off'
});
if (this.switch.state === 'off') {
print("SWITCH STATE " + JSON.stringify(_this._switch));
if (this._switch.state === 'off') {
this.fanRotationOn();
this.fanSoundOn();
this.ventSoundOn();

View file

@ -13,7 +13,7 @@
(function() {
Script.include('../utils.js');
// Script.include('../utils.js');
var SCALE = 0.5;
var VICTORY_SOUND;
@ -96,7 +96,7 @@
if (this.ballLocked === true) {
return;
}
if(this.ball!==null){
if (this.ball !== null) {
Entities.deleteEntity(this.ball);
}
@ -113,7 +113,12 @@
gravity: BALL_GRAVITY,
density: BALL_DENSITY,
color: BALL_COLOR,
dimensions: BALL_DIMENSIONS
dimensions: BALL_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
this.ball = Entities.addEntity(properties);
@ -197,7 +202,7 @@
_this.ballLocked = false;
_this.createBall();
}, 1500)
}
}
},
playVictorySound: function() {
var position = Entities.getEntityProperties(this.entityID, "position").position;

View file

@ -82,6 +82,11 @@ TiltMaze = function(spawnPosition, spawnRotation) {
var MAZE_RESTITUTION = 0.1;
var MAZE_DAMPING = 0.6;
var MAZE_ANGULAR_DAMPING = 0.6;
var MAZE_GRAVITY = {
x: 0,
y: -3,
z: 0
};
var DETECTOR_VERTICAL_OFFSET = 0.0 * SCALE;
var DETECTOR_FORWARD_OFFSET = 0.35 * SCALE;
@ -149,6 +154,9 @@ TiltMaze = function(spawnPosition, spawnRotation) {
color: BALL_COLOR,
dimensions: BALL_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
grabbableKey: {
grabbable: false
}
@ -170,6 +178,11 @@ TiltMaze = function(spawnPosition, spawnRotation) {
position: getBallStartLocation(),
collisionless: true,
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
ballSpawningAnchor = Entities.addEntity(properties);
@ -189,6 +202,12 @@ TiltMaze = function(spawnPosition, spawnRotation) {
collisionless: true,
dynamic: false,
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
ballDetector = Entities.addEntity(properties);
@ -200,6 +219,7 @@ TiltMaze = function(spawnPosition, spawnRotation) {
name: 'Hifi Tilt Maze',
type: 'Model',
modelURL: MAZE_MODEL_URL,
gravity: MAZE_GRAVITY,
compoundShapeURL: MAZE_COLLISION_HULL,
dimensions: MAZE_DIMENSIONS,
position: position,
@ -208,7 +228,12 @@ TiltMaze = function(spawnPosition, spawnRotation) {
angularDamping: MAZE_ANGULAR_DAMPING,
dynamic: true,
density: MAZE_DENSITY,
script: MAZE_SCRIPT
script: MAZE_SCRIPT,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
if (spawnRotation !== undefined) {
@ -240,7 +265,12 @@ TiltMaze = function(spawnPosition, spawnRotation) {
cutoff: END_LIGHT_CUTOFF,
lifetime: -1,
position: position,
rotation: emitOrientation
rotation: emitOrientation,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
lightAtTheEnd = Entities.addEntity(lightProperties);
@ -254,6 +284,9 @@ TiltMaze = function(spawnPosition, spawnRotation) {
createLightAtTheEnd();
Entities.editEntity(tiltMaze, {
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
tiltMaze: {
firstBall: ball,
ballSpawner: ballSpawningAnchor,
@ -267,6 +300,7 @@ TiltMaze = function(spawnPosition, spawnRotation) {
createAll();
function cleanup() {
print('MAZE CLEANUP')
Entities.deleteEntity(tiltMaze);
Entities.deleteEntity(ball);
Entities.deleteEntity(ballSpawningAnchor);
@ -274,5 +308,6 @@ TiltMaze = function(spawnPosition, spawnRotation) {
}
this.cleanup = cleanup;
print('CREATED TILTMAZE')
}

View file

@ -142,6 +142,11 @@
textures: _this.MARKER_TEXTURE_URL,
color: _this.markerColor,
lifetime: 5000,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
_this.linePoints = [];

View file

@ -16,24 +16,15 @@ var MARKER_SCRIPT_URL = Script.resolvePath("markerEntityScript.js?" + Math.rando
Whiteboard = function(spawnPosition, spawnRotation) {
var orientation = MyAvatar.orientation;
orientation = Quat.safeEulerAngles(orientation);
var markerRotation = Quat.fromVec3Degrees({
x: orientation.x + 10,
y: orientation.y - 90,
z: orientation.z
})
orientation.x = 0;
var whiteboardRotation = Quat.fromVec3Degrees({
x: 0,
y: orientation.y,
z: 0
});
orientation = Quat.fromVec3Degrees(orientation);
var orientation = Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z);
var markers = [];
var whiteboardPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(orientation)));
var markerRotation = Quat.fromVec3Degrees({
x: spawnRotation.x + 10,
y: spawnRotation.y - 90,
z: spawnRotation.z
});
var whiteboardPosition = spawnPosition;
var whiteboardRotation = orientation;
var WHITEBOARD_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/Whiteboard-4.fbx";
var WHITEBOARD_COLLISION_HULL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/whiteboardCollisionHull.obj";
var whiteboard = Entities.addEntity({
@ -49,9 +40,14 @@ Whiteboard = function(spawnPosition, spawnRotation) {
y: 2.7,
z: 0.4636
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
print('whiteboard:' + whiteboard)
var whiteboardSurfacePosition = Vec3.sum(whiteboardPosition, {
x: 0.0,
@ -77,7 +73,12 @@ Whiteboard = function(spawnPosition, spawnRotation) {
position: whiteboardFrontSurfacePosition,
rotation: whiteboardRotation,
visible: false,
parentID: whiteboard
parentID: whiteboard,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
var whiteboardFrontDrawingSurface = Entities.addEntity(whiteboardSurfaceSettings);
@ -92,7 +93,7 @@ Whiteboard = function(spawnPosition, spawnRotation) {
var ERASER_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/eraser-2.fbx";
var eraserPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(WHITEBOARD_RACK_DEPTH, Quat.getFront(whiteboardRotation)));
var eraserPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.5, Quat.getRight(whiteboardRotation)));
var eraserRotation = markerRotation;
@ -120,6 +121,9 @@ Whiteboard = function(spawnPosition, spawnRotation) {
z: 0
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
originalPosition: eraserPosition,
originalRotation: eraserRotation,
wearable: {
@ -157,8 +161,7 @@ Whiteboard = function(spawnPosition, spawnRotation) {
"https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/marker-red.fbx",
"https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/marker-black.fbx",
];
var markerPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(WHITEBOARD_RACK_DEPTH, Quat.getFront(orientation)));
var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
createMarker(modelURLS[0], markerPosition, {
red: 10,
@ -209,6 +212,9 @@ Whiteboard = function(spawnPosition, spawnRotation) {
name: "marker",
script: MARKER_SCRIPT_URL,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
originalPosition: markerPosition,
originalRotation: markerRotation,
markerColor: markerColor,
@ -244,6 +250,7 @@ Whiteboard = function(spawnPosition, spawnRotation) {
}
function cleanup() {
print('WHITEBOARD CLEANUP')
Entities.deleteEntity(whiteboard);
Entities.deleteEntity(whiteboardFrontDrawingSurface);
Entities.deleteEntity(whiteboardBackDrawingSurface);
@ -254,4 +261,6 @@ Whiteboard = function(spawnPosition, spawnRotation) {
}
this.cleanup = cleanup;
print('CREATED WHITEBOARD')
}