Merge pull request #12 from ericrius1/homereset

Clock works with arbitrary rotations
This commit is contained in:
James B. Pollack 2016-03-23 15:24:45 -07:00
commit 95d246e483
5 changed files with 834 additions and 63 deletions

View file

@ -85,13 +85,16 @@
var myDate = new Date();
var seconds = myDate.getSeconds();
secondRollDegrees = -seconds * DEGREES_FOR_SECOND;
Entities.editEntity(_this.secondHand, {
rotation: Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees)
});
// var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees);
// var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation);
// Entities.editEntity(_this.secondHand, {
// rotation: worldClockHandRotation
// });
},
unload: function() {
baton.unload();
if (connected === true) {
connected = false;
Script.update.disconnect(_this.update);

View file

@ -13,7 +13,7 @@ var MINUTE_HAND_CLOCK_SCRIPT_URL = Script.resolvePath("cuckooClockMinuteHandEnti
var CLOCK_BODY_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/cuckooClock/cuckoo2_BODY.fbx";
var CLOCK_FACE_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_FACE.fbx";
var CLOCK_HOUR_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_HOUR_HAND.fbx";
var CLOCK_MINUTE_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_MINUTE_HAND.fbx";
var CLOCK_MINUTE_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_MINUTE_HAND.fbx?v5";
var CLOCK_SECOND_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/secondHand.fbx";
MyCuckooClock = function(spawnPosition, spawnRotation) {
@ -24,7 +24,7 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
clockBody = Entities.addEntity({
type: "Model",
modelURL: CLOCK_BODY_URL,
name: "hifi-home_model_clockbody",
name: "hifi-home-model-clockbody",
animation: {
url: CLOCK_BODY_URL,
running: false,
@ -47,16 +47,19 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
})
})
var clockFaceOffset = {
x: -0.0345,
y: 0.2587,
z: 0.1255
};
var clockFacePosition = Vec3.sum(spawnPosition, clockFaceOffset);
var forwardOffset = -0.13
var upOffset = 0.255;
var sideOffset = -0.03;
var clockFacePosition = spawnPosition;
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), forwardOffset));
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getUp(clockRotation), upOffset));
clockFacePosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getRight(clockRotation), sideOffset));
clockFace = Entities.addEntity({
type: "Model",
parentID: clockBody,
name: "hifi-home_model_clockface",
rotation: clockRotation,
name: "hifi-home-model-clockface",
modelURL: CLOCK_FACE_URL,
position: clockFacePosition,
dimensions: {
@ -78,36 +81,40 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
// /|\
// ___________
var clockHandOffset = {
x: -0.0007,
y: -0.0015,
z: 0.0121
};
var myDate = new Date()
// HOUR HAND *************************
var clockHandForwardOffset = -0.017;
// HOUR HAND *************************
var hourHandPosition = Vec3.sum(clockFacePosition, Vec3.multiply(Quat.getFront(clockRotation), clockHandForwardOffset));
var DEGREES_FOR_HOUR = 30
var hours = myDate.getHours();
var hourRollDegrees = -hours * DEGREES_FOR_HOUR;
var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, hourRollDegrees);
var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation);
var ANGULAR_ROLL_SPEED_HOUR_RADIANS = 0.000029098833;
var localAngularVelocity = {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_HOUR_RADIANS
};
var worldAngularVelocity = Vec3.multiplyQbyV(clockRotation, localAngularVelocity);
clockHourHand = Entities.addEntity({
type: "Model",
name: "hifi-home_model_clockHourHand",
name: "hifi-home-model-clockHourHand",
parentID: clockFace,
modelURL: CLOCK_HOUR_HAND_URL,
position: Vec3.sum(clockFacePosition, clockHandOffset),
position: hourHandPosition,
registrationPoint: {
x: 0.5,
y: 0.05,
z: 0.5
},
rotation: Quat.fromPitchYawRollDegrees(0, 0, hourRollDegrees),
rotation: worldClockHandRotation,
angularDamping: 0,
angularVelocity: {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_HOUR_RADIANS
},
angularVelocity: worldAngularVelocity,
dimensions: {
x: 0.0263,
y: 0.0982,
@ -125,18 +132,26 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
var DEGREES_FOR_SECOND = 6;
var seconds = myDate.getSeconds();
secondRollDegrees = -seconds * DEGREES_FOR_SECOND;
var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees);
var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation);
var ANGULAR_ROLL_SPEED_SECOND_RADIANS = 0.10472
var localAngularVelocity = {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_SECOND_RADIANS
};
var worldAngularVelocity = Vec3.multiplyQbyV(clockRotation, localAngularVelocity);
clockSecondHand = Entities.addEntity({
type: "Model",
parentID: clockBody,
modelURL: CLOCK_SECOND_HAND_URL,
name: "hifi-home_model_clockSecondHand",
position: Vec3.sum(clockFacePosition, clockHandOffset),
// dimensions: {
// x: 0.00263,
// y: 0.0982,
// z: 0.0024
// },
name: "hifi-home-model-clockSecondHand",
position: hourHandPosition,
dimensions: {
x: 0.0043,
y: 0.1117,
z: 0.0008
},
color: {
red: 200,
green: 10,
@ -147,13 +162,9 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
y: 0.05,
z: 0.5
},
// rotation: Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees),
rotation: worldClockHandRotation,
angularDamping: 0,
angularVelocity: {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_SECOND_RADIANS
},
angularVelocity: worldAngularVelocity,
userData: JSON.stringify({
hifiHomeKey: {
reset: true
@ -166,25 +177,31 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
var DEGREES_FOR_MINUTE = 6;
var minutes = myDate.getMinutes();
var minuteRollDegrees = -minutes * DEGREES_FOR_MINUTE;
var localClockHandRotation = Quat.fromPitchYawRollDegrees(0, 0, minuteRollDegrees);
var worldClockHandRotation = Quat.multiply(clockRotation, localClockHandRotation);
var ANGULAR_ROLL_SPEED_MINUTE_RADIANS = 0.00174533;
var localAngularVelocity = {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_MINUTE_RADIANS
};
var worldAngularVelocity = Vec3.multiplyQbyV(clockRotation, localAngularVelocity);
clockMinuteHand = Entities.addEntity({
type: "Model",
modelURL: CLOCK_MINUTE_HAND_URL,
name: "hifi-home_model_clockMinuteHand",
modelURL: CLOCK_HOUR_HAND_URL,
name: "hifi-home-model-clockMinuteHand",
parentID: clockFace,
position: Vec3.sum(clockFacePosition, clockHandOffset),
position: hourHandPosition,
registrationPoint: {
x: 0.5,
y: 0.05,
z: 0.5
},
rotation: Quat.fromPitchYawRollDegrees(0, 0, minuteRollDegrees),
rotation:worldClockHandRotation,
angularDamping: 0,
angularVelocity: {
x: 0,
y: 0,
z: -ANGULAR_ROLL_SPEED_MINUTE_RADIANS
},
angularVelocity: worldAngularVelocity,
dimensions: {
x: 0.0251,
y: 0.1179,

View file

@ -0,0 +1,725 @@
{
"Entities": [
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{5371218c-e05b-49da-ac70-81f1f76c55ea}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.69732666015625,
"y": 0.1600341796875,
"z": 0.28265380859375
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.6540253758430481,
"y": 0.11673291027545929,
"z": 0.23935253918170929
},
"rotation": {
"w": 0.996917724609375,
"x": -0.0001678466796875,
"y": 0.078294038772583008,
"z": -0.0003204345703125
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ccc1198a-a501-48b8-959a-68297258aea7}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.47344970703125,
"y": 0.06005859375,
"z": 0.30706787109375
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.4301484227180481,
"y": 0.01675732433795929,
"z": 0.2637665867805481
},
"rotation": {
"w": 0.70644688606262207,
"x": 0.70638585090637207,
"y": -0.030960559844970703,
"z": 0.031174182891845703
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3aaf5dd5-16d8-4852-880d-8256de68de19}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.2613525390625,
"y": 0.01007080078125,
"z": 0.359466552734375
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.12442189455032349,
"y": -0.12685984373092651,
"z": 0.22253590822219849
},
"rotation": {
"w": -4.57763671875e-05,
"x": 0.35637450218200684,
"y": -4.57763671875e-05,
"z": 0.93432521820068359
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{0474a29f-c45b-4d42-ae95-0c0bd1e6c501}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.30487060546875,
"y": 0.01007080078125,
"z": 0.188262939453125
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.17651562392711639,
"y": -0.11828418076038361,
"z": 0.059907957911491394
},
"rotation": {
"w": 0.99496448040008545,
"x": 1.52587890625e-05,
"y": 0.10020601749420166,
"z": 0.0002288818359375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{53e06851-8346-45ac-bdb5-0a74c99b5bd5}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.40277099609375,
"y": 0.035064697265625,
"z": 0.254364013671875
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.25915694236755371,
"y": -0.10854937136173248,
"z": 0.11074994504451752
},
"rotation": {
"w": 0.70650792121887207,
"x": -0.031143665313720703,
"y": -0.031143665313720703,
"z": 0.70632481575012207
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{38bcb70d-e384-4b60-878a-e34d4830f045}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.54962158203125,
"y": 0.010040283203125,
"z": 0.294647216796875
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.42126661539077759,
"y": -0.11831469833850861,
"z": 0.16629223525524139
},
"rotation": {
"w": 0.999969482421875,
"x": -7.62939453125e-05,
"y": -0.0037384629249572754,
"z": 0.0001068115234375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{fa8f8bbc-5bd0-4121-985d-75ce2f68eba1}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.52001953125,
"y": 0.01007080078125,
"z": 0
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.38308888673782349,
"y": -0.12685984373092651,
"z": -0.13693064451217651
},
"rotation": {
"w": 0.9861142635345459,
"x": -7.62939453125e-05,
"y": -0.16603344678878784,
"z": -7.62939453125e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.029999999329447746,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{d4b8582b-b707-453c-89c6-65e358da5cd7}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_yellow.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.66876220703125,
"y": 0,
"z": 0.012939453125
},
"queryAACube": {
"scale": 0.25670996308326721,
"x": 0.54040724039077759,
"y": -0.12835498154163361,
"z": -0.11541552841663361
},
"rotation": {
"w": 0.70589756965637207,
"x": 0.036270737648010254,
"y": -0.036331713199615479,
"z": -0.70647746324539185
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3b5b53fb-7ee5-44eb-9b81-8de8a525c433}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.83819580078125,
"y": 0.135040283203125,
"z": 0.261627197265625
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.70126515626907349,
"y": -0.0018903613090515137,
"z": 0.12469655275344849
},
"rotation": {
"w": 0.69332420825958252,
"x": 0.13832306861877441,
"y": -0.13841456174850464,
"z": -0.69353783130645752
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{0d1f27e9-7e74-4263-9428-8c8f7aac94a6}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.61773681640625,
"y": 0.0350341796875,
"z": 0.265533447265625
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.47412276268005371,
"y": -0.10857988893985748,
"z": 0.12191937863826752
},
"rotation": {
"w": 0.9998779296875,
"x": -4.57763671875e-05,
"y": -0.014206171035766602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{79ea518f-aac3-45ff-b22d-6d295b3c9e87}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.7188720703125,
"y": 0.08502197265625,
"z": 0.26397705078125
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.57525801658630371,
"y": -0.058592095971107483,
"z": 0.12036298215389252
},
"rotation": {
"w": 0.99993896484375,
"x": -4.57763671875e-05,
"y": -0.0099946856498718262,
"z": -0.0001068115234375
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ff470ff9-c889-4893-a25f-80895bff0e9a}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.74981689453125,
"y": 0.010040283203125,
"z": 0.258575439453125
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.61991310119628906,
"y": -0.11986352503299713,
"z": 0.12867163121700287
},
"rotation": {
"w": 0.99993896484375,
"x": -4.57763671875e-05,
"y": -0.010666072368621826,
"z": -0.0003814697265625
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.10000000149011612,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{b5319f85-603d-436b-8bbe-fc9f798ca738}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_green.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.8824462890625,
"y": 0.0350341796875,
"z": 0.281097412109375
},
"queryAACube": {
"scale": 0.28722813725471497,
"x": 0.73883223533630371,
"y": -0.10857988893985748,
"z": 0.13748334348201752
},
"rotation": {
"w": 0.999847412109375,
"x": -4.57763671875e-05,
"y": -0.016922235488891602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{944a4616-8dac-4d6a-a92b-49fa98514416}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.963623046875,
"y": 0.010009765625,
"z": 0.25885009765625
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.83371925354003906,
"y": -0.11989404261112213,
"z": 0.12894628942012787
},
"rotation": {
"w": 0.999847412109375,
"x": -4.57763671875e-05,
"y": -0.017379999160766602,
"z": 1.52587890625e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ea6a1038-7047-4a1e-bdbd-076d6e41508c}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_blue.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.49188232421875,
"y": 0.010040283203125,
"z": 0.27752685546875
},
"queryAACube": {
"scale": 0.25980761647224426,
"x": 0.36197853088378906,
"y": -0.11986352503299713,
"z": 0.14762304723262787
},
"rotation": {
"w": 0.99798583984375,
"x": -4.57763671875e-05,
"y": -0.063248634338378906,
"z": 4.57763671875e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{ff65f5dd-2d53-4127-86da-05156a42946d}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0,
"y": 0.010101318359375,
"z": 0.353302001953125
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": -0.04330126941204071,
"y": -0.03319995105266571,
"z": 0.3100007176399231
},
"rotation": {
"w": 0.55049967765808105,
"x": 0.44353401660919189,
"y": -0.44359505176544189,
"z": -0.55083543062210083
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.10000000149011612,
"y": 0.05000000074505806,
"z": 0.25
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{3a9acd14-f754-4c70-b294-9f622c000785}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_red.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.88006591796875,
"y": 0.010040283203125,
"z": 0.05718994140625
},
"queryAACube": {
"scale": 0.27386128902435303,
"x": 0.74313527345657349,
"y": -0.12689036130905151,
"z": -0.079740703105926514
},
"rotation": {
"w": 0.86965739727020264,
"x": -4.57763671875e-05,
"y": -0.4936751127243042,
"z": -4.57763671875e-05
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"collisionSoundURL": "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav",
"collisionsWillMove": 1,
"created": "2016-03-23T21:29:36Z",
"dimensions": {
"x": 0.05000000074505806,
"y": 0.05000000074505806,
"z": 0.05000000074505806
},
"dynamic": 1,
"gravity": {
"x": 0,
"y": -2.5,
"z": 0
},
"velocity": {"x": 0, "y": -0.1, "z": 0},
"id": "{bb014301-247b-44d0-8b09-b830fea4439e}",
"modelURL": "http://s3.amazonaws.com/hifi-public/models/content/planky/planky_natural.fbx",
"name": "hifi-home-model-block",
"position": {
"x": 0.80487060546875,
"y": 0.010040283203125,
"z": 0.19500732421875
},
"queryAACube": {
"scale": 0.086602538824081421,
"x": 0.7615693211555481,
"y": -0.03326098620891571,
"z": 0.15170605480670929
},
"rotation": {
"w": 0.70440220832824707,
"x": 0.060776710510253906,
"y": -0.060868263244628906,
"z": -0.70455479621887207
},
"shapeType": "box",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
}
],
"Version": 57
}

View file

@ -11,6 +11,7 @@ var FRUIT_BOWL_URL = 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/ki
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();
@ -21,7 +22,6 @@ FruitBowl = function(spawnLocation, spawnRotation) {
function create() {
var success = Clipboard.importEntities(FRUIT_BOWL_URL);
if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
@ -49,7 +49,6 @@ LabLamp = function(spawnLocation, spawnRotation) {
function create() {
var success = Clipboard.importEntities(LAB_LAMP_URL);
if (success === true) {
hasBow = true;
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
@ -253,6 +252,30 @@ Books = function(spawnLocation, spawnRotation) {
this.cleanup = cleanup;
}
Blocks = function(spawnLocation, spawnRotation) {
print('CREATE BLOCKS')
var created = [];
function create() {
var success = Clipboard.importEntities(BLOCKS_URL);
if (success === true) {
created = Clipboard.pasteEntities(spawnLocation)
print('created ' + created);
}
};
function cleanup() {
created.forEach(function(obj) {
Entities.deleteEntity(obj);
})
};
create();
this.cleanup = cleanup;
}
PosterCell = function(spawnLocation, spawnRotation) {
print('CREATE CELL POSTER')
var created = [];

View file

@ -89,7 +89,7 @@
_this.showTidyingButton();
_this.playTidyingSound();
_this.findAndDeleteHomeEntities();
// _this.findAndDeleteHomeEntities();
Script.setTimeout(function() {
_this.showTidyButton();
_this.tidying = false;
@ -118,19 +118,18 @@
createDynamicEntities: function() {
print("EBL CREATE DYNAMIC ENTITIES");
var fishTank = new FishTank({
x: 1098.9254,
y: 460.5814,
z: -79.1103
}, {
x: 0,
y: 152,
y: 0,
z: 0
});
//REMOVE BEFORE MERGE
return;
var tiltMaze = new TiltMaze({
x: 1105.5768,
y: 460.3298,
@ -166,26 +165,30 @@
y: 179.0293,
z: 89.9698
});
//v2.0
// var musicBox = new MusicBox();
//var cuckooClock = new MyCuckooClock(center);
var cuckooClock = new MyCuckooClock({
x: 1105.172,
x: 1105.267,
y: 461.44,
z: -81.86
z: -81.9495
}, {
x: 0,
y: 0,
y: -57,
z: 0
});
//v2.0
// var musicBox = new MusicBox();
// var doppelganger = new Doppelganger();
},
createKineticEntities: function() {
//REMOVE BEFORE MERGE
return;
var blocks = new Blocks({
x: 1097.1383,
y: 460.3790,
z: -66.4895
});
var fruitBowl = new FruitBowl({
x: 1105.3185,
y: 460.3221,