adeed blocks

This commit is contained in:
ericrius1 2016-03-23 15:18:21 -07:00
commit dd5e972a5c
10 changed files with 567 additions and 267 deletions

View file

@ -24,7 +24,7 @@
var TANK_SEARCH_RADIUS = 5;
var WANT_LOOK_DEBUG_LINE = false;
var WANT_LOOK_DEBUG_SPHERE = false;
var WANT_LOOK_DEBUG_SPHERE = true;
var INTERSECT_COLOR = {
red: 255,
@ -42,6 +42,7 @@
iOwn = true;
connected = true;
Script.update.connect(_this.update);
print('JBP connecting in startupdate')
}
function stopUpdateAndReclaim() {
@ -107,10 +108,13 @@
if (properties.hasOwnProperty('userData') === false || properties.userData.length === 0) {
_this.initTimeout = Script.setTimeout(function() {
if (properties.hasOwnProperty('userData')) {
// print('has user data property')
print('JBP has user data property')
}
if (properties.userData.length === 0) {
// print('user data length is zero')
print('JBP user data length is zero')
}
if (properties.userData === "") {
print('JBP user data is empty')
}
// print('try again in one second')
@ -122,9 +126,10 @@
_this.userData = null;
try {
_this.userData = JSON.parse(properties.userData);
print('JBP set userdata to parsed json')
} catch (err) {
// print('error parsing json');
// print('properties are:' + properties.userData);
print('JBP error parsing json');
print('JBP properties are:' + properties.userData);
return;
}
// print('after parse')
@ -171,7 +176,7 @@
// print('i am the owner!')
//do stuff
updateFish(deltaTime);
_this.seeIfOwnerIsLookingAtTheTank();
// _this.seeIfOwnerIsLookingAtTheTank();
},
debugSphereOn: function(position) {
@ -416,8 +421,7 @@
}
}
// print('has userdata fish??' + _this.userData['hifi-home-fishtank'].fishLoaded)
// print('jbp has userdata fish??' + JSON.stringify(_this.userData))
if (_this.userData['hifi-home-fishtank'].fishLoaded === false) {
//no fish in the user data
@ -427,11 +431,6 @@
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,
}
@ -476,15 +475,27 @@
var innerContainer = userData['hifi-home-fishtank']['innerContainer'];
// var bounds = Entities.getEntityProperties(innerContainer, "boundingBox").boundingBox;
lowerCorner = getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET);
upperCorner = getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET);
// print('LOADFISH LOWER' + JSON.stringify(lowerCorner));
// print('LOADFISH UPPER' + JSON.stringify(upperCorner));
// First pre-load an array with properties on all the other fish so our per-fish loop
// isn't doing it.
var flockProperties = [];
var tankProps = Entities.getEntityProperties(_this.entityID);
var tankXForm = new Xform(tankProps.rotation, tankProps.position);
var inverseTankXForm = tankXForm.inv();
var lowerCorner = getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET);
var upperCorner = getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET);
lowerCorner = inverseTankXForm.xFormPoint(lowerCorner);
upperCorner = inverseTankXForm.xFormPoint(upperCorner);
for (var i = 0; i < fish.length; i++) {
var otherProps = Entities.getEntityProperties(fish[i], ["position", "velocity", "rotation"]);
otherProps.position = inverseTankXForm.xFormPoint(otherProps.position);
otherProps.velocity = inverseTankXForm.xFormVector(otherProps.velocity)
flockProperties.push(otherProps);
}
@ -509,16 +520,7 @@
y: properties.position.y,
z: properties.position.z
};
averageVelocity = {
x: 0,
y: 0,
z: 0
};
averagePosition = {
x: 0,
y: 0,
z: 0
};
var othersCounted = 0;
for (var j = 0; j < fish.length; j++) {
@ -550,15 +552,6 @@
//attractors
//[position, radius, force]
}
if (_this.hasLookAttractor === true) {
//print('has a look attractor, so use it')
var attractorPosition = _this.lookAttractor.position;
var towardAttractor = Vec3.subtract(attractorPosition, position);
velocity = Vec3.mix(velocity, Vec3.multiply(Vec3.normalize(towardAttractor), Vec3.length(velocity)), LOOK_ATTRACTOR_FORCE);
}
// Try to swim at a constant speed
@ -588,36 +581,50 @@
}
// Orient in direction of velocity
var rotation = Quat.rotationBetween(Vec3.UNIT_NEG_Z, velocity);
var mixedRotation = Quat.mix(properties.rotation, rotation, VELOCITY_FOLLOW_RATE);
var VELOCITY_FOLLOW_RATE = 0.30;
// var mixedRotation = Quat.mix(properties.rotation, rotation, VELOCITY_FOLLOW_RATE);
// var VELOCITY_FOLLOW_RATE = 0.30;
var slerpedRotation = Quat.slerp(properties.rotation, rotation, VELOCITY_FOLLOW_RATE);
// var slerpedRotation = Quat.slerp(properties.rotation, rotation, VELOCITY_FOLLOW_RATE);
var safeEuler = Quat.safeEulerAngles(rotation);
safeEuler.z = safeEuler.z *= 0.925;
// var safeEuler = Quat.safeEulerAngles(rotation);
// safeEuler.z = safeEuler.z *= 0.925;
//note: a we want the fish to both rotate toward its velocity and not roll over, and also not pitch more than 30 degrees positive or negative (not doing that last bit right quite yet)
var newQuat = Quat.fromPitchYawRollDegrees(safeEuler.x, safeEuler.y, safeEuler.z);
// //note: a we want the fish to both rotate toward its velocity and not roll over, and also not pitch more than 30 degrees positive or negative (not doing that last bit right quite yet)
// var newQuat = Quat.fromPitchYawRollDegrees(safeEuler.x, safeEuler.y, safeEuler.z);
var finalQuat = Quat.slerp(slerpedRotation, newQuat, 0.5);
// var finalQuat = Quat.slerp(slerpedRotation, newQuat, 0.5);
// Only update properties if they have changed, to save bandwidth
var MIN_POSITION_CHANGE_FOR_UPDATE = 0.001;
if (Vec3.distance(properties.position, position) < MIN_POSITION_CHANGE_FOR_UPDATE) {
Entities.editEntity(fish[i], {
velocity: velocity,
rotation: finalQuat
});
} else {
Entities.editEntity(fish[i], {
position: position,
velocity: velocity,
rotation: finalQuat
});
}
// // Only update properties if they have changed, to save bandwidth
// var MIN_POSITION_CHANGE_FOR_UPDATE = 0.001;
var primePosition = tankXForm.xFormPoint(position);
var primeVelocity = tankXForm.xFormVector(velocity);
var rotation = Quat.rotationBetween(Vec3.UNIT_NEG_Z, primeVelocity);
var normalizedPrimeVelocity = Vec3.normalize(primeVelocity)
var pitch = Math.acos(Vec3.dot(normalizedPrimeVelocity,{x:0,y:1,z:0}));
// if (Vec3.distance(properties.position, position) < MIN_POSITION_CHANGE_FOR_UPDATE) {
// print('under min position change')
// Entities.editEntity(fish[i], {
// velocity: primeVector,
// // rotation: finalQuat
// });
// } else {
// Entities.editEntity(fish[i], {
// position: primePosition,
// velocity: primeVector,
// // rotation: finalQuat
// });
// }
Entities.editEntity(fish[i], {
position: primePosition,
velocity: primeVelocity,
// rotation: rotation
});
}
}
}
@ -629,12 +636,12 @@
_this.currentProperties = Entities.getEntityProperties(_this.entityID);
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)
@ -658,7 +665,7 @@
type: "Model",
modelURL: fish.length % 2 === 0 ? FISH_MODEL_URL : FISH_MODEL_TWO_URL,
position: position,
parentID: _this.entityID,
// parentID: _this.entityID,
// rotation: {
// x: 0,
// y: 0,
@ -680,7 +687,12 @@
red: 0,
green: 255,
blue: 255
}
},
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
})
);
@ -694,7 +706,6 @@
Script.update.disconnect(_this.update);
})
function setEntityUserData(id, data) {
var json = JSON.stringify(data)
Entities.editEntity(id, {
@ -738,21 +749,49 @@
}
}
function transformFishFromTankToWorldSpace(position, velocity) {
function Xform(rot, pos) {
this.rot = rot;
this.pos = pos;
};
var Q = Entities.getEntityProperties(_this.entityID).rotation;
var tPosition = Vec3.multiplyQbyV(Q, position);
var tVelocity = Vec3.multiplyQbyV(Q, velocity);
Xform.ident = function() {
return new Xform({
x: 0,
y: 0,
z: 0,
w: 1
}, {
x: 0,
y: 0,
z: 0
});
};
var inverseQ = Quat.inverse(Q);
var finalPosition = Vec3.multiplyQbyV(inverseQ, tPosition);
var finalVelocity = Vec3.multiplyQbyV(inverseQ,tVelocity);
Xform.mul = function(lhs, rhs) {
var rot = Quat.multiply(lhs.rot, rhs.rot);
var pos = Vec3.sum(lhs.pos, Vec3.multiplyQbyV(lhs.rot, rhs.pos));
return new Xform(rot, pos);
};
return {
position: finalPosition,
velocity: finalVelocity
};
}
Xform.prototype.inv = function() {
var invRot = Quat.inverse(this.rot);
var invPos = Vec3.multiply(-1, this.pos);
return new Xform(invRot, Vec3.multiplyQbyV(invRot, invPos));
};
Xform.prototype.xFormPoint = function(point) {
return Vec3.sum(Vec3.multiplyQbyV(this.rot, point), this.pos);
};
Xform.prototype.xFormVector = function(vector) {
return Vec3.multiplyQbyV(this.rot, vector);
};
Xform.prototype.toString = function() {
var rot = this.rot;
var pos = this.pos;
return "Xform rot = (" + rot.x + ", " + rot.y + ", " + rot.z + ", " + rot.w + "), pos = (" + pos.x + ", " + pos.y + ", " + pos.z + ")";
};
return new FishTank();
});

View file

@ -117,11 +117,16 @@ FishTank = function(spawnPosition, spawnRotation) {
modelURL: TANK_MODEL_URL,
dimensions: TANK_DIMENSIONS,
position: TANK_POSITION,
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x,spawnRotation.y,spawnRotation.z),
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
color: DEBUG_COLOR,
collisionless: true,
script: TANK_SCRIPT,
visible: true
visible: true,
// userData: JSON.stringify({
// 'hifiHomeKey': {
// 'reset': true
// }
// }),
}
fishTank = Entities.addEntity(tankProperties);
@ -172,7 +177,12 @@ 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";
@ -239,7 +249,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);
@ -265,7 +280,12 @@ FishTank = function(spawnPosition, spawnRotation) {
},
collisionless: true,
position: getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET),
visible: false
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
var upperProps = {
@ -284,7 +304,12 @@ FishTank = function(spawnPosition, spawnRotation) {
},
collisionless: true,
position: getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET),
visible: false
visible: false,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
lowerCorner = Entities.addEntity(lowerProps);
@ -301,7 +326,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);
@ -327,7 +357,12 @@ FishTank = function(spawnPosition, spawnRotation) {
position: finalPosition,
shapeType: 'Sphere',
rotation: Quat.fromPitchYawRollDegrees(0, 90, 0),
dimensions: ANEMONE_DIMENSIONS
dimensions: ANEMONE_DIMENSIONS,
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
}
anemone = Entities.addEntity(properties);
@ -344,7 +379,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);
@ -363,7 +403,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

@ -0,0 +1,89 @@
{
"Entities": [{
"angularVelocity": {
"x": -0.00071254139766097069,
"y": 0.0045778844505548477,
"z": -0.0034651262685656548
},
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.obj",
"created": "2016-03-22T22:55:11Z",
"dimensions": {
"x": 0.35158795118331909,
"y": 0.27823561429977417,
"z": 0.35158795118331909
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2,
"z": 0
},
"id": "{638e562d-77cc-45ee-b2c7-f5c678cf83eb}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Shade.fbx",
"position": {
"x": 1104.558349609375,
"y": 460.93505859375,
"z": 0
},
"queryAACube": {
"scale": 0.56977474689483643,
"x": 1104.2734375,
"y": 460.65017700195312,
"z": -0.28488737344741821
},
"restitution": 0.20000000298023224,
"rotation": {
"w": 0.80972349643707275,
"x": 8.0799843999557197e-05,
"y": -0.58680325746536255,
"z": 0.0031326396856456995
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}, {
"angularVelocity": {
"x": -0.0025625245179980993,
"y": -0.00052156101446598768,
"z": 0.000514673360157758
},
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.obj",
"created": "2016-03-22T22:50:49Z",
"dimensions": {
"x": 0.26436957716941833,
"y": 0.73171323537826538,
"z": 0.26436954736709595
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -9,
"z": 0
},
"id": "{1fdc3a04-fbee-4f23-bdf8-c44c58258388}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Lamp-Bulldog-Base.fbx",
"position": {
"x": 1104.5577392578125,
"y": 460.7225341796875,
"z": 0.0018768310546875
},
"queryAACube": {
"scale": 0.82169753313064575,
"x": 1104.1468505859375,
"y": 460.31167602539062,
"z": -0.40897193551063538
},
"rotation": {
"w": 0.98707658052444458,
"x": -5.647468424285762e-05,
"y": -0.16024939715862274,
"z": 2.5912273486028425e-05
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -1,35 +0,0 @@
{
"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

@ -1,35 +0,0 @@
{
"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,74 @@
{
"Entities": [{
"color": {
"blue": 117,
"green": 117,
"red": 117
},
"created": "2016-03-23T17:14:01Z",
"dimensions": {
"x": 0.20582196116447449,
"y": 0.032061770558357239,
"z": 0.14119282364845276
},
"id": "{fb17c832-d450-4293-a9b5-5b2d0425e8fc}",
"name": "Poster-Nail",
"position": {
"x": 1103.8148193359375,
"y": 461.78707885742188,
"z": 3.0988998413085938
},
"queryAACube": {
"scale": 0.25164666771888733,
"x": 1103.68896484375,
"y": 461.6612548828125,
"z": 2.9730765819549561
},
"rotation": {
"w": 0.96362245082855225,
"x": -1.52587890625e-05,
"y": 0.26723122596740723,
"z": -1.52587890625e-05
},
"type": "Box",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}, {
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Poster2.obj",
"created": "2016-03-23T19:05:25Z",
"dimensions": {
"x": 0.057196967303752899,
"y": 1.1607639789581299,
"z": 0.87844705581665039
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -5,
"z": 0
},
"id": "{9eec1faa-9e1a-4d76-abeb-a1b1175a44d5}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Cellscience-Poster-2.fbx",
"position": {
"x": 1103.866943359375,
"y": 461.2822265625,
"z": 3.0254440307617188
},
"queryAACube": {
"scale": 1.4568163156509399,
"x": 1103.1385498046875,
"y": 460.5538330078125,
"z": 2.2970359325408936
},
"rotation": {
"w": -0.28834974765777588,
"x": 0.023819327354431152,
"y": 0.95718324184417725,
"z": -0.0075837373733520508
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,75 @@
{
"Entities": [{
"collisionsWillMove": 1,
"compoundShapeURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Poster2.obj",
"created": "2016-03-23T17:16:12Z",
"dimensions": {
"x": 0.047816216945648193,
"y": 1.2243480682373047,
"z": 0.92656642198562622
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2,
"z": 0
},
"id": "{2b5ca0a0-9115-4916-bee6-63f88d3909b1}",
"modelURL": "http://hifi-content.s3.amazonaws.com/alan/dev/Playa-Poster.fbx",
"position": {
"x": 1101.8731689453125,
"y": 461.19500732421875,
"z": 0
},
"queryAACube": {
"scale": 1.5361770391464233,
"x": 1101.1051025390625,
"y": 460.42691040039062,
"z": -0.76808851957321167
},
"restitution": 0.10000000149011612,
"rotation": {
"w": -0.29161518812179565,
"x": 0.0086823701858520508,
"y": 0.9564812183380127,
"z": -0.0002593994140625
},
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}, {
"color": {
"blue": 117,
"green": 117,
"red": 117
},
"created": "2016-03-23T17:14:01Z",
"dimensions": {
"x": 0.20582196116447449,
"y": 0.032061770558357239,
"z": 0.14119282364845276
},
"id": "{7f060027-2927-4513-bd92-13a98e6fc06c}",
"name": "Poster-Nail",
"position": {
"x": 1101.77685546875,
"y": 461.72821044921875,
"z": 0.0442657470703125
},
"queryAACube": {
"scale": 0.25164666771888733,
"x": 1101.6510009765625,
"y": 461.60238647460938,
"z": -0.081557586789131165
},
"rotation": {
"w": 0.96362245082855225,
"x": -1.52587890625e-05,
"y": 0.26723122596740723,
"z": -1.52587890625e-05
},
"type": "Box",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}],
"Version": 57
}

View file

@ -8,11 +8,12 @@ var LEFT_DESK_DRAWER_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/H
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 LAB_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/deskLamp.json' + "?" + Math.random();
var LIVING_ROOM_LAMP_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/deskLamp.json' + "?" + Math.random();
var TRASHCAN_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/trashcan.json' + "?" + Math.random();
var BLOCKS_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/blocks.json' + "?" + Math.random();
var PLAYA_POSTER_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/postersPlaya.json' + "?" + Math.random();
var CELL_POSTER_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/kineticObjects/trashcan.json' + "?" + Math.random();
FruitBowl = function(spawnLocation, spawnRotation) {
print('CREATE FRUIT BOWL')
@ -252,7 +253,7 @@ Books = function(spawnLocation, spawnRotation) {
}
Blocks = function(spawnLocation, spawnRotation) {
print('EBL CREATE BLOCKS')
print('CREATE BLOCKS')
var created = [];
function create() {
@ -271,5 +272,52 @@ Blocks = function(spawnLocation, spawnRotation) {
create();
this.cleanup = cleanup;
}
PosterCell = function(spawnLocation, spawnRotation) {
print('CREATE CELL POSTER')
var created = [];
function create() {
var success = Clipboard.importEntities(CELL_POSTER_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
PosterPlaya = function(spawnLocation, spawnRotation) {
print('CREATE PLAYA POSTER')
var created = [];
function create() {
var success = Clipboard.importEntities(PLAYA_POSTER_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

@ -117,129 +117,130 @@
},
createDynamicEntities: function() {
print("EBL CREATE DYNAMIC ENTITIES");
// var fishTank = new FishTank({
// x: 1098.9254,
// y: 460.5814,
// z: -79.1103
// }, {
// x: 0,
// y: 0,
// z: 0
// });
var fishTank = new FishTank({
x: 1098.9254,
y: 460.5814,
z: -79.1103
}, {
x: 0,
y: 0,
z: 0
});
// var tiltMaze = new TiltMaze({
// x: 1105.5768,
// y: 460.3298,
// z: -80.4891
// });
var tiltMaze = new TiltMaze({
x: 1105.5768,
y: 460.3298,
z: -80.4891
});
// var whiteboard = new Whiteboard({
// x: 1104,
// y: 460.5,
// z: -77
// }, {
// x: 0,
// y: -133,
// z: 0
// });
var whiteboard = new Whiteboard({
x: 1104,
y: 460.5,
z: -77
}, {
x: 0,
y: -133,
z: 0
});
// var myPlant = new Plant({
// x: 1099.8785,
// y: 460.3115,
// z: -84.7736
// }, {
// x: 0,
// y: 0,
// z: 0
// });
var myPlant = new Plant({
x: 1099.8785,
y: 460.3115,
z: -84.7736
}, {
x: 0,
y: 0,
z: 0
});
var pingPongGun = new _PingPongGun({
x: 1101.2123,
y: 460.2328,
z: -65.8513
}, {
x: 97.3683,
y: 179.0293,
z: 89.9698
});
var cuckooClock = new MyCuckooClock({
x: 1105.267,
y: 461.44,
z: -81.9495
}, {
x: 0,
y: -57,
z: 0
});
// var pingPongGun = new _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();
// var cuckooClock = new MyCuckooClock({
// x: 1105.267,
// y: 461.44,
// z: -81.9495
// }, {
// x: 0,
// y: -57,
// z: 0
// });
// var doppelganger = new Doppelganger();
},
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
// });
print("EBL CREATE KINETIC ENTITIES");
var blocks = new Blocks({
x: 1097.3383,
x: 1097.1383,
y: 460.3790,
z: -66.8895
z: -66.4895
});
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
});
},
@ -270,7 +271,7 @@
print('JBP after deleting home entities')
},
unload: function() {
// this.findAndDeleteHomeEntities();
this.findAndDeleteHomeEntities();
}
}

View file

@ -24,7 +24,6 @@
var BALL_RIGHT_OFFSET = -0.4 * SCALE;
var BALL_VERTICAL_OFFSET = 0.02 * SCALE;
var BALL_FRICTION = 0.7;
var BALL_RESTITUTION = 0.1;
var BALL_DAMPING = 0.6;