add reset userdata to everything

This commit is contained in:
James B. Pollack 2016-03-17 22:19:20 -07:00
parent c072cd323e
commit 0f17d1f12e
22 changed files with 504 additions and 338 deletions

View file

@ -188,7 +188,12 @@
},
color: INTERSECT_COLOR,
position: position,
collisionless: true
collisionless: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
_this.debugSphere = Entities.addEntity(sphereProperties);
},
@ -640,7 +645,12 @@
red: 0,
green: 255,
blue: 255
}
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
})
);

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';
@ -107,11 +107,11 @@ FishTank = function(spawnPosition, spawnRotation) {
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 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 UPPER_CORNER_LATERAL_OFFSET = TANK_DIMENSIONS.z / 8;
function createFishTank() {
var tankProperties = {
@ -124,7 +124,12 @@ FishTank = function(spawnPosition, spawnRotation) {
color: DEBUG_COLOR,
collisionless: true,
script: TANK_SCRIPT,
visible: true
visible: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
if (spawnRotation !== undefined) {
@ -179,13 +184,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;
@ -246,7 +258,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);
@ -271,7 +288,12 @@ FishTank = function(spawnPosition, spawnRotation) {
},
collisionless: true,
position: getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET),
visible: true
visible: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
var upperProps = {
@ -290,7 +312,12 @@ FishTank = function(spawnPosition, spawnRotation) {
},
collisionless: true,
position: getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET),
visible: true
visible: true,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
lowerCorner = Entities.addEntity(lowerProps);
@ -307,7 +334,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);
@ -323,7 +355,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);
@ -340,7 +377,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);
@ -359,7 +401,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);

View file

@ -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

@ -15,6 +15,7 @@
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

@ -32,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
}
}),
});
@ -55,7 +60,12 @@ Plant = function(spawnPosition, spawnRotation) {
dimensions: plantDimensions,
position: plantPosition,
script: PLANT_SCRIPT_URL,
parentID: bowl
parentID: bowl,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
@ -84,6 +94,9 @@ Plant = function(spawnPosition, spawnRotation) {
},
rotation: waterCanRotation,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
wearable: {
joints: {
RightHand: [{
@ -130,7 +143,12 @@ Plant = function(spawnPosition, spawnRotation) {
position: waterSpoutPosition,
rotation: waterSpoutRotation,
parentID: waterCan,
visible: false
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
function cleanup() {
@ -143,7 +161,7 @@ Plant = function(spawnPosition, spawnRotation) {
this.cleanup = cleanup;
print('CREATED PLANT:: '+ plant)
print('CREATED PLANT:: ' + plant)
}

View file

@ -1,5 +1,6 @@
{
"Entities": [{
"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": {
@ -30,6 +31,7 @@
},
"type": "Model"
}, {
"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": {
@ -61,6 +63,7 @@
"shapeType": "box",
"type": "Model"
}, {
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"created": "2016-03-15T21:26:11Z",
"dimensions": {
"x": 0.23445942997932434,
@ -91,6 +94,7 @@
"shapeType": "box",
"type": "Model"
}, {
"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": {
@ -122,6 +126,7 @@
"shapeType": "box",
"type": "Model"
}, {
"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": {
@ -152,6 +157,7 @@
"shapeType": "box",
"type": "Model"
}, {
"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": {
@ -183,6 +189,7 @@
"shapeType": "box",
"type": "Model"
}, {
"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": {
@ -212,6 +219,7 @@
},
"type": "Model"
}, {
"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": {

View file

@ -1,5 +1,6 @@
{
"Entities": [{
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/simple-chair2.obj",
"created": "2016-03-07T21:07:29Z",
"dimensions": {
@ -28,8 +29,7 @@
"z": 0.0002593994140625
},
"shapeType": "compound",
"type": "Model",
"userData": "{}"
"type": "Model"
}],
"Version": 57
}

View file

@ -1,277 +1,270 @@
{
"Entities": [
{
"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": "{}"
"Entities": [{
"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
},
{
"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": "{}"
"dynamic": 1,
"gravity": {
"x": 0,
"y": -7,
"z": 0
},
{
"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": "{\"grabbableKey\":{\"grabbable\":true}}"
"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
},
{
"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": "{}"
"queryAACube": {
"scale": 0.50641506910324097,
"x": -0.13638624548912048,
"y": -0.25320753455162048,
"z": -0.13730177283287048
},
{
"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": "{\"grabbableKey\":{\"grabbable\":true}}"
"rotation": {
"w": 0.49941253662109375,
"x": -4.57763671875e-05,
"y": 0.86633098125457764,
"z": -0.0001068115234375
},
{
"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": "{}"
"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
},
{
"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",
"userData": "{\"grabbableKey\":{\"grabbable\":true}}"
}
],
"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},\"grabbableKey\":{\"grabbable\":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},\"grabbableKey\":{\"grabbable\":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},\"grabbableKey\":{\"grabbable\":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",
"userData": "{\"hifiHomeKey\":{\"reset\":true},\"grabbableKey\":{\"grabbable\":true}}"
}],
"Version": 57
}
}

View file

@ -1,5 +1,6 @@
{
"Entities": [{
"userData": "{\"hifiHomeKey\":{\"reset\":true}}",
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Little-Lamp.obj",
"created": "2016-03-16T01:00:16Z",
"dimensions": {
@ -29,7 +30,6 @@
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"grabbableKey\":{\"grabbable\":true,\"wantsTrigger\":true}}"
}],
"Version": 57
}

View file

@ -29,7 +29,7 @@
},
"shapeType": "compound",
"type": "Model",
"userData": "{}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -29,7 +29,7 @@
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"grabbableKey\":{\"grabbable\":true,\"wantsTrigger\":true}}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -26,7 +26,7 @@
"z": -0.88293278217315674
},
"type": "Box",
"userData": "{}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -29,7 +29,7 @@
},
"shapeType": "compound",
"type": "Model",
"userData": "{}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -31,7 +31,7 @@
},
"shapeType": "compound",
"type": "Model",
"userData": "{}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}
],
"Version": 57

View file

@ -26,7 +26,7 @@
"z": -0.88293278217315674
},
"type": "Box",
"userData": "{}"
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -109,7 +109,12 @@
rotation: gunProperties.rotation,
position: this.getGunTipPosition(gunProperties),
velocity: forwardVec,
lifetime: 10
lifetime: 10,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
Entities.addEntity(properties);
@ -125,7 +130,7 @@
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);

View file

@ -28,13 +28,16 @@ _PingPongGun = function(spawnPosition, spawnRotation) {
y: 0.3875,
z: 0.9931
},
rotation:Quat.fromPitchYawRollDegrees(spawnRotation.x,spawnRotation.y,spawnRotation.z),
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: [{
@ -69,6 +72,6 @@ _PingPongGun = function(spawnPosition, spawnRotation) {
this.cleanup = cleanup;
print('CREATED PING PONG GUN')
print('CREATED PING PONG GUN')
}

View file

@ -79,8 +79,10 @@
_this.tidying = true;
_this.showTidyingButton();
_this.playTidyingSound();
_this.cleanupDynamicEntities();
_this.cleanupKineticEntities();
_this.findAndDeleteHomeEntities();
// _this.cleanupDynamicEntities();
// _this.cleanupKineticEntities();
Script.setTimeout(function() {
_this.showTidyButton();
_this.tidying = false;
@ -158,22 +160,19 @@
z: 89.9698
});
dynamicEntities.push(fishTank);
dynamicEntities.push(tiltMaze);
dynamicEntities.push(whiteboard);
dynamicEntities.push(pingPongGun);
dynamicEntities.push(myPlant);
//v2.0
print('DYNAMIC ENTITIES AFTER CREATE:::' + dynamicEntities.length)
// var musicBox = new MusicBox();
// var cuckooClock = new CuckooClock();
// var musicBox = new MusicBox();
// var cuckooClock = new CuckooClock();
// var doppelganger = new Doppelganger();
// dynamicEntities.push(fishTank);
// dynamicEntities.push(tiltMaze);
// dynamicEntities.push(whiteboard);
// dynamicEntities.push(pingPongGun);
// dynamicEntities.push(myPlant);
// print('DYNAMIC ENTITIES AFTER CREATE:::' + dynamicEntities.length)
},
@ -245,15 +244,15 @@
z: -80.4890
});
kineticEntities.push(fruitBowl);
kineticEntities.push(livingRoomLamp);
kineticEntities.push(upperBookShelf);
kineticEntities.push(lowerBookShelf);
kineticEntities.push(rightDeskDrawer);
kineticEntities.push(leftDeskDrawer);
kineticEntities.push(chair);
kineticEntities.push(trashcan);
kineticEntities.push(books);
// kineticEntities.push(fruitBowl);
// kineticEntities.push(livingRoomLamp);
// kineticEntities.push(upperBookShelf);
// kineticEntities.push(lowerBookShelf);
// kineticEntities.push(rightDeskDrawer);
// kineticEntities.push(leftDeskDrawer);
// kineticEntities.push(chair);
// kineticEntities.push(trashcan);
// kineticEntities.push(books);
},
cleanupKineticEntities: function() {
@ -265,9 +264,29 @@
kineticEntity.cleanup();
})
},
findAndDeleteHomeEntities: function() {
var results = Entities.findEntities(_this.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.hifiHomeKey.reset === true) {
Entities.deleteEntity(result);
}
})
},
unload: function() {
this.cleanupDynamicEntities();
this.cleanupKineticEntities();
this.findAndDeleteHomeEntities();
// this.cleanupDynamicEntities();
// this.cleanupKineticEntities();
}
}

View file

@ -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

@ -83,9 +83,9 @@ TiltMaze = function(spawnPosition, spawnRotation) {
var MAZE_DAMPING = 0.6;
var MAZE_ANGULAR_DAMPING = 0.6;
var MAZE_GRAVITY = {
x:0,
y:-3,
z:0
x: 0,
y: -3,
z: 0
};
var DETECTOR_VERTICAL_OFFSET = 0.0 * SCALE;
@ -154,6 +154,9 @@ TiltMaze = function(spawnPosition, spawnRotation) {
color: BALL_COLOR,
dimensions: BALL_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
grabbableKey: {
grabbable: false
}
@ -175,6 +178,11 @@ TiltMaze = function(spawnPosition, spawnRotation) {
position: getBallStartLocation(),
collisionless: true,
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
ballSpawningAnchor = Entities.addEntity(properties);
@ -194,6 +202,12 @@ TiltMaze = function(spawnPosition, spawnRotation) {
collisionless: true,
dynamic: false,
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
};
ballDetector = Entities.addEntity(properties);
@ -205,7 +219,7 @@ TiltMaze = function(spawnPosition, spawnRotation) {
name: 'Hifi Tilt Maze',
type: 'Model',
modelURL: MAZE_MODEL_URL,
gravity:MAZE_GRAVITY,
gravity: MAZE_GRAVITY,
compoundShapeURL: MAZE_COLLISION_HULL,
dimensions: MAZE_DIMENSIONS,
position: position,
@ -214,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) {
@ -246,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);
@ -260,6 +284,9 @@ TiltMaze = function(spawnPosition, spawnRotation) {
createLightAtTheEnd();
Entities.editEntity(tiltMaze, {
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
tiltMaze: {
firstBall: ball,
ballSpawner: ballSpawningAnchor,

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

@ -36,6 +36,11 @@ Whiteboard = function(spawnPosition, spawnRotation) {
y: 2.7,
z: 0.4636
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
});
@ -64,7 +69,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);
@ -107,6 +117,9 @@ Whiteboard = function(spawnPosition, spawnRotation) {
z: 0
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
originalPosition: eraserPosition,
originalRotation: eraserRotation,
wearable: {
@ -196,6 +209,9 @@ Whiteboard = function(spawnPosition, spawnRotation) {
name: "marker",
script: MARKER_SCRIPT_URL,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
},
originalPosition: markerPosition,
originalRotation: markerRotation,
markerColor: markerColor,