From bd4e3b346075e285f84397f447a5e7e5f5a6f21f Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 5 Apr 2016 15:01:08 -0700 Subject: [PATCH 1/4] whiteboard markers and erasers now spawn back at rack when they collide with home --- .../Home/whiteboard/eraserEntityScript.js | 9 ++++- .../Home/whiteboard/markerEntityScript.js | 20 ++-------- .../Home/whiteboard/singleSpawner.js | 12 ++++++ .../DomainContent/Home/whiteboard/wrapper.js | 38 ++++++++++++++++--- 4 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 unpublishedScripts/DomainContent/Home/whiteboard/singleSpawner.js diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/eraserEntityScript.js b/unpublishedScripts/DomainContent/Home/whiteboard/eraserEntityScript.js index 9740c7380b..4175c65e96 100644 --- a/unpublishedScripts/DomainContent/Home/whiteboard/eraserEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/whiteboard/eraserEntityScript.js @@ -84,15 +84,20 @@ var otherProps = Entities.getEntityProperties(otherID); if (otherProps.name === 'home_model_homeset') { var userData = getEntityUserData(_this.entityID); - Entities.editEntity(_this.entityID) { + Entities.editEntity(_this.entityID, { position: userData.originalPosition, rotation: userData.originalRotation, velocity: { x: 0, y: -0.01, z: 0 + }, + angularVelocity: { + x: 0, + y: 0, + z: 0 } - } + }); } }, diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/markerEntityScript.js b/unpublishedScripts/DomainContent/Home/whiteboard/markerEntityScript.js index 6440044964..1f07172a45 100644 --- a/unpublishedScripts/DomainContent/Home/whiteboard/markerEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/whiteboard/markerEntityScript.js @@ -67,34 +67,22 @@ visible: false }); - // Once user releases marker, wait a bit then put marker back to its original position and rotation - // Script.setTimeout(function() { - // var userData = getEntityUserData(_this.entityID); - // Entities.editEntity(_this.entityID, { - // position: userData.originalPosition, - // rotation: userData.originalRotation, - // velocity: { - // x: 0, - // y: -0.01, - // z: 0 - // } - // }); - // }, _this.MARKER_RESET_WAIT_TIME); }, collisionWithEntity: function(myID, otherID, collision) { var otherProps = Entities.getEntityProperties(otherID); if (otherProps.name === 'home_model_homeset') { var userData = getEntityUserData(_this.entityID); - Entities.editEntity(_this.entityID) { + Entities.editEntity(_this.entityID, { position: userData.originalPosition, rotation: userData.originalRotation, velocity: { x: 0, y: -0.01, z: 0 - } - } + }, + angularVelocity: {x: 0, y: 0, z: 0} + }) } }, continueEquip: function() { diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/singleSpawner.js b/unpublishedScripts/DomainContent/Home/whiteboard/singleSpawner.js new file mode 100644 index 0000000000..5ed8fbe33f --- /dev/null +++ b/unpublishedScripts/DomainContent/Home/whiteboard/singleSpawner.js @@ -0,0 +1,12 @@ + var whiteboardPath = Script.resolvePath('wrapper.js'); +Script.include(whiteboardPath); + + var whiteboard = new Whiteboard({ + x: 1104, + y: 460.5, + z: -77 + }, { + x: 0, + y: -133, + z: 0 + }); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js b/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js index 95a6f9b6b9..9a292cd4f6 100644 --- a/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js @@ -25,8 +25,14 @@ Whiteboard = function(spawnPosition, spawnRotation) { }); var whiteboardPosition = spawnPosition; var whiteboardRotation = orientation; - var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx"; - var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj"; + + // var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx"; + // var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj"; + + // EBL REMOVE ME + var WHITEBOARD_MODEL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/Whiteboard-4.fbx"; + var WHITEBOARD_COLLISION_HULL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/whiteboardCollisionHull.obj"; + var whiteboard = Entities.addEntity({ type: "Model", name: "home_model_whiteboard", @@ -92,8 +98,16 @@ Whiteboard = function(spawnPosition, spawnRotation) { var WHITEBOARD_RACK_DEPTH = 1.9; + + + // ************ ERAAAAAAASSSEERRRR ************************************************ + // ******************************************************************************** var ERASER_MODEL_URL = "atp:/whiteboard/eraser-2.fbx"; + // EBL REMOVE ME + var ERASER_MODEL_URL = "https://s3.amazonaws.com/hifi-public/eric/models/eraser.fbx"; + + 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; @@ -156,11 +170,23 @@ Whiteboard = function(spawnPosition, spawnRotation) { } + // ************************************************************************************************* + // ************************************************************************************************* + // ************************************************************************************************* + function createMarkers() { + // var modelURLS = [ + // "atp:/whiteboard/marker-blue.fbx", + // "atp:/whiteboard/marker-red.fbx", + // "atp:/whiteboard/marker-black.fbx", + // ]; + + + // EBL REMOVE ME var modelURLS = [ - "atp:/whiteboard/marker-blue.fbx", - "atp:/whiteboard/marker-red.fbx", - "atp:/whiteboard/marker-black.fbx", + "https://hifi-content.s3.amazonaws.com/eric/models/marker-black.fbx", + "https://hifi-content.s3.amazonaws.com/eric/models/marker-red.fbx", + "https://hifi-content.s3.amazonaws.com/eric/models/marker-blue.fbx", ]; var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1)); @@ -196,7 +222,7 @@ Whiteboard = function(spawnPosition, spawnRotation) { dynamic: true, gravity: { x: 0, - y: -10, + y: -5, z: 0 }, velocity: { From 1257fac0f53fafcb0ddf5f8489052be7f22a723f Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 5 Apr 2016 15:08:32 -0700 Subject: [PATCH 2/4] removed s3 paths --- .../DomainContent/Home/whiteboard/wrapper.js | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js b/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js index 9a292cd4f6..5fbac2259c 100644 --- a/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/whiteboard/wrapper.js @@ -26,12 +26,8 @@ Whiteboard = function(spawnPosition, spawnRotation) { var whiteboardPosition = spawnPosition; var whiteboardRotation = orientation; - // var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx"; - // var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj"; - - // EBL REMOVE ME - var WHITEBOARD_MODEL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/Whiteboard-4.fbx"; - var WHITEBOARD_COLLISION_HULL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/whiteboardCollisionHull.obj"; + var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx"; + var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj"; var whiteboard = Entities.addEntity({ type: "Model", @@ -100,14 +96,11 @@ Whiteboard = function(spawnPosition, spawnRotation) { - // ************ ERAAAAAAASSSEERRRR ************************************************ - // ******************************************************************************** + // ************ ERASER ************************************************ var ERASER_MODEL_URL = "atp:/whiteboard/eraser-2.fbx"; - // EBL REMOVE ME - var ERASER_MODEL_URL = "https://s3.amazonaws.com/hifi-public/eric/models/eraser.fbx"; - + 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; @@ -170,24 +163,16 @@ Whiteboard = function(spawnPosition, spawnRotation) { } - // ************************************************************************************************* - // ************************************************************************************************* // ************************************************************************************************* function createMarkers() { - // var modelURLS = [ - // "atp:/whiteboard/marker-blue.fbx", - // "atp:/whiteboard/marker-red.fbx", - // "atp:/whiteboard/marker-black.fbx", - // ]; - - - // EBL REMOVE ME var modelURLS = [ - "https://hifi-content.s3.amazonaws.com/eric/models/marker-black.fbx", - "https://hifi-content.s3.amazonaws.com/eric/models/marker-red.fbx", - "https://hifi-content.s3.amazonaws.com/eric/models/marker-blue.fbx", + "atp:/whiteboard/marker-blue.fbx", + "atp:/whiteboard/marker-red.fbx", + "atp:/whiteboard/marker-black.fbx", ]; + + var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1)); createMarker(modelURLS[0], markerPosition, { From bf46eda6c103206563dd38564ef8c8665c4dd9d6 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 5 Apr 2016 15:57:32 -0700 Subject: [PATCH 3/4] name changes --- .../Home/kineticObjects/blocks.json | 36 +++++++++---------- .../DomainContent/Home/pingPongGun/wrapper.js | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/kineticObjects/blocks.json b/unpublishedScripts/DomainContent/Home/kineticObjects/blocks.json index b7854ce5cb..08331169de 100644 --- a/unpublishedScripts/DomainContent/Home/kineticObjects/blocks.json +++ b/unpublishedScripts/DomainContent/Home/kineticObjects/blocks.json @@ -21,7 +21,7 @@ }, "id": "{5371218c-e05b-49da-ac70-81f1f76c55ea}", "modelURL": "atp:/kineticObjects/blocks/planky_natural.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.69732666015625, "y": 0.1600341796875, @@ -64,7 +64,7 @@ }, "id": "{ccc1198a-a501-48b8-959a-68297258aea7}", "modelURL": "atp:/kineticObjects/blocks/planky_natural.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.47344970703125, "y": 0.06005859375, @@ -107,7 +107,7 @@ }, "id": "{3aaf5dd5-16d8-4852-880d-8256de68de19}", "modelURL": "atp:/kineticObjects/blocks/planky_red.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.2613525390625, "y": 0.01007080078125, @@ -150,7 +150,7 @@ }, "id": "{0474a29f-c45b-4d42-ae95-0c0bd1e6c501}", "modelURL": "atp:/kineticObjects/blocks/planky_yellow.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.30487060546875, "y": 0.01007080078125, @@ -193,7 +193,7 @@ }, "id": "{53e06851-8346-45ac-bdb5-0a74c99b5bd5}", "modelURL": "atp:/kineticObjects/blocks/planky_green.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.40277099609375, "y": 0.035064697265625, @@ -236,7 +236,7 @@ }, "id": "{38bcb70d-e384-4b60-878a-e34d4830f045}", "modelURL": "atp:/kineticObjects/blocks/planky_yellow.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.54962158203125, "y": 0.010040283203125, @@ -279,7 +279,7 @@ }, "id": "{fa8f8bbc-5bd0-4121-985d-75ce2f68eba1}", "modelURL": "atp:/kineticObjects/blocks/planky_red.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.52001953125, "y": 0.01007080078125, @@ -322,7 +322,7 @@ }, "id": "{d4b8582b-b707-453c-89c6-65e358da5cd7}", "modelURL": "atp:/kineticObjects/blocks/planky_yellow.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.66876220703125, "y": 0, @@ -365,7 +365,7 @@ }, "id": "{3b5b53fb-7ee5-44eb-9b81-8de8a525c433}", "modelURL": "atp:/kineticObjects/blocks/planky_red.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.83819580078125, "y": 0.135040283203125, @@ -408,7 +408,7 @@ }, "id": "{0d1f27e9-7e74-4263-9428-8c8f7aac94a6}", "modelURL": "atp:/kineticObjects/blocks/planky_green.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.61773681640625, "y": 0.0350341796875, @@ -451,7 +451,7 @@ }, "id": "{79ea518f-aac3-45ff-b22d-6d295b3c9e87}", "modelURL": "atp:/kineticObjects/blocks/planky_green.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.7188720703125, "y": 0.08502197265625, @@ -494,7 +494,7 @@ }, "id": "{ff470ff9-c889-4893-a25f-80895bff0e9a}", "modelURL": "atp:/kineticObjects/blocks/planky_blue.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.74981689453125, "y": 0.010040283203125, @@ -537,7 +537,7 @@ }, "id": "{b5319f85-603d-436b-8bbe-fc9f798ca738}", "modelURL": "atp:/kineticObjects/blocks/planky_green.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.8824462890625, "y": 0.0350341796875, @@ -580,7 +580,7 @@ }, "id": "{944a4616-8dac-4d6a-a92b-49fa98514416}", "modelURL": "atp:/kineticObjects/blocks/planky_blue.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.963623046875, "y": 0.010009765625, @@ -623,7 +623,7 @@ }, "id": "{ea6a1038-7047-4a1e-bdbd-076d6e41508c}", "modelURL": "atp:/kineticObjects/blocks/planky_blue.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.49188232421875, "y": 0.010040283203125, @@ -666,7 +666,7 @@ }, "id": "{ff65f5dd-2d53-4127-86da-05156a42946d}", "modelURL": "atp:/kineticObjects/blocks/planky_natural.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0, "y": 0.010101318359375, @@ -709,7 +709,7 @@ }, "id": "{3a9acd14-f754-4c70-b294-9f622c000785}", "modelURL": "atp:/kineticObjects/blocks/planky_red.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.88006591796875, "y": 0.010040283203125, @@ -752,7 +752,7 @@ }, "id": "{bb014301-247b-44d0-8b09-b830fea4439e}", "modelURL": "atp:/kineticObjects/blocks/planky_natural.fbx", - "name": "hifi-home-model-block", + "name": "home_model_block", "position": { "x": 0.80487060546875, "y": 0.010040283203125, diff --git a/unpublishedScripts/DomainContent/Home/pingPongGun/wrapper.js b/unpublishedScripts/DomainContent/Home/pingPongGun/wrapper.js index 93544e5113..cf9a12b734 100644 --- a/unpublishedScripts/DomainContent/Home/pingPongGun/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/pingPongGun/wrapper.js @@ -17,6 +17,7 @@ var COLLISION_HULL_URL = 'atp:/pingPongGun/Pingpong-Gun-New.obj'; HomePingPongGun = function(spawnPosition, spawnRotation) { var pingPongGun = Entities.addEntity({ type: "Model", + name: "home_model_pingPongGun" modelURL: MODEL_URL, shapeType: 'compound', compoundShapeURL: COLLISION_HULL_URL, From ed3b9ab2092df2ccd262c72cdd28031c21627bb3 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 5 Apr 2016 16:42:04 -0700 Subject: [PATCH 4/4] lamp is now always grabbable --- .../Home/kineticObjects/deskLamp.json | 48 ++----------------- .../Home/switches/livingRoomDeskLamp.js | 8 +--- 2 files changed, 5 insertions(+), 51 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json b/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json index 950a6ef3ab..06f3190d81 100644 --- a/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json +++ b/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json @@ -1,46 +1,5 @@ { "Entities": [{ - "collisionless": 1, - "color": { - "blue": 0, - "green": 0, - "red": 255 - }, - "created": "2016-03-24T22:17:16Z", - "dimensions": { - "x": 0.2776367485523224, - "y": 0.27723021268844604, - "z": 0.2535492241382599 - }, - "id": "{c7c6108b-4c60-4735-b2bf-5559d7e30e7d}", - "collisionless": 1, - "dynamic": 1, - "shapeType": "box", - "name": "home_box_livingRoomDeskLampTrigger", - "parentID": "{f59b50d8-13fb-4ceb-b80a-62cd03428a7c}", - "position": { - "x": 0.0062166899442672729, - "y": -0.1577162891626358, - "z": -0.0018789069727063179 - }, - "queryAACube": { - "scale": 6.92822265625, - "x": 1101.2117919921875, - "y": 456.86856079101562, - "z": -84.708488464355469 - }, - "rotation": { - "w": 0.84585332870483398, - "x": 1.52587890625e-05, - "y": 0.53337907791137695, - "z": -0.0001373291015625 - }, - "script": "atp:/switches/livingRoomDeskLamp.js", - "scriptTimestamp": 1458860464095, - "type": "Box", - "userData": "{\"hifiHomeKey\":{\"reset\":true},\"home-switch\":{\"state\":\"off\"}}", - "visible": 0 - }, { "color": { "blue": 68, "green": 252, @@ -56,9 +15,9 @@ "falloffRadius": 0.30000001192092896, "id": "{47e2c415-854c-4b6a-b71e-06c760675afd}", "intensity": 20, - "isSpotlight": 1, + "isSpotlight": 0, "name": "home_light_livingRoomLight", - "parentID": "{c7c6108b-4c60-4735-b2bf-5559d7e30e7d}", + "parentID": "{f59b50d8-13fb-4ceb-b80a-62cd03428a7c}", "position": { "x": 0, "y": -0.14917388558387756, @@ -133,6 +92,7 @@ "z": 0.26436954736709595 }, "dynamic": 1, + "script": "atp:/switches/livingRoomDeskLamp.js", "gravity": { "x": 0, "y": -10, @@ -160,7 +120,7 @@ }, "shapeType": "compound", "type": "Model", - "userData": "{\"hifiHomeKey\":{\"reset\":true}}", + "userData": "{\"hifiHomeKey\":{\"reset\":true},\"home-switch\":{\"state\":\"off\"}}", "velocity": { "x": -0.0026286719366908073, "y": 0.0016162246465682983, diff --git a/unpublishedScripts/DomainContent/Home/switches/livingRoomDeskLamp.js b/unpublishedScripts/DomainContent/Home/switches/livingRoomDeskLamp.js index 791908c5b8..e012af6c17 100644 --- a/unpublishedScripts/DomainContent/Home/switches/livingRoomDeskLamp.js +++ b/unpublishedScripts/DomainContent/Home/switches/livingRoomDeskLamp.js @@ -19,7 +19,7 @@ this.toggleLights(); }, - startNearTrigger: function() { + startNearGrab: function() { this.toggleLights(); }, @@ -67,8 +67,6 @@ if (properties.name === _this.lightName) { print("EBL FOUND THE LIGHT!"); found.push(result); - } else { - print("EBL DID NOT FIND THE LIGHT!"); } }); return found; @@ -132,10 +130,6 @@ preload: function(entityID) { print("EBL PRELOAD LIGHT SWITCH SCRIPT"); this.entityID = entityID; - setEntityCustomData('grabbableKey', this.entityID, { - wantsTrigger: true - }); - var properties = Entities.getEntityProperties(this.entityID);