From 9730d07f59e94c3f7c635a2de2cbc6951a651cfa Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 16 Dec 2016 16:01:44 -0800 Subject: [PATCH] Cleanup tutorial scripts --- .../touchControllerConfiguration.js | 18 ++--- tutorial/tutorial.js | 73 +++++++++---------- tutorial/tutorialEntityIDs.js | 5 -- 3 files changed, 41 insertions(+), 55 deletions(-) diff --git a/scripts/system/controllers/touchControllerConfiguration.js b/scripts/system/controllers/touchControllerConfiguration.js index fb7ec92e1c..6241a776c4 100644 --- a/scripts/system/controllers/touchControllerConfiguration.js +++ b/scripts/system/controllers/touchControllerConfiguration.js @@ -12,23 +12,15 @@ /* eslint camelcase: ["error", { "properties": "never" }] */ var leftBaseRotation = Quat.multiply( - Quat.fromPitchYawRollDegrees(0, 0, 0), - Quat.multiply( - Quat.fromPitchYawRollDegrees(-90, 0, 0), - Quat.fromPitchYawRollDegrees(0, 0, 90) - ) + Quat.fromPitchYawRollDegrees(-90, 0, 0), + Quat.fromPitchYawRollDegrees(0, 0, 90) ); -//var leftBaseRotation = Quat.fromPitchYawRollDegrees(0, 0, 0); - var rightBaseRotation = Quat.multiply( - Quat.fromPitchYawRollDegrees(0, 0, 0), - Quat.multiply( - Quat.fromPitchYawRollDegrees(-90, 0, 0), - Quat.fromPitchYawRollDegrees(0, 0, -90) - ) + Quat.fromPitchYawRollDegrees(-90, 0, 0), + Quat.fromPitchYawRollDegrees(0, 0, -90) ); -// keep these in sync with the values from SteamVRHelpers.cpp +// keep these in sync with the values from OculusHelpers.cpp var CONTROLLER_LENGTH_OFFSET = 0.0762; var CONTROLLER_LATERAL_OFFSET = 0.0381; var CONTROLLER_VERTICAL_OFFSET = 0.0381; diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 5ca165b656..b75bf74579 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -126,10 +126,11 @@ function setControllerPartLayer(part, layer) { } /** - * @param {object[]} entityPropertiesList A list of properties to + * Spawn entities and return the newly created entity's ids. + * @param {object[]} entityPropertiesList A list of properties of the entities + * to spawn. */ function spawn(entityPropertiesList, transform, modifyFn) { - debug("Creating: ", entityPropertiesList); if (!transform) { transform = { position: { x: 0, y: 0, z: 0 }, @@ -139,7 +140,6 @@ function spawn(entityPropertiesList, transform, modifyFn) { var ids = []; for (var i = 0; i < entityPropertiesList.length; ++i) { var data = entityPropertiesList[i]; - debug("Creating: ", data.name); data.position = Vec3.sum(transform.position, data.position); data.rotation = Quat.multiply(data.rotation, transform.rotation); if (modifyFn) { @@ -147,7 +147,6 @@ function spawn(entityPropertiesList, transform, modifyFn) { } var id = Entities.addEntity(data); ids.push(id); - debug(id, "data:", JSON.stringify(data)); } return ids; } @@ -258,25 +257,25 @@ function showEntitiesWithTag(tag) { debug("ERROR | No entities for tag: ", tag); } - // Dynamic method, suppressed for now return; - editEntitiesWithTag(tag, function(entityID) { - var userData = Entities.getEntityProperties(entityID, "userData").userData; - var data = parseJSON(userData); - var collisionless = data.visible === false ? true : false; - if (data.collidable !== undefined) { - collisionless = data.collidable === true ? false : true; - } - if (data.soundKey) { - data.soundKey.playing = true; - } - var newProperties = { - visible: data.visible == false ? false : true, - collisionless: collisionless, - userData: JSON.stringify(data), - }; - Entities.editEntity(entityID, newProperties); - }); + // Dynamic method, suppressed for now + //editEntitiesWithTag(tag, function(entityID) { + // var userData = Entities.getEntityProperties(entityID, "userData").userData; + // var data = parseJSON(userData); + // var collisionless = data.visible === false ? true : false; + // if (data.collidable !== undefined) { + // collisionless = data.collidable === true ? false : true; + // } + // if (data.soundKey) { + // data.soundKey.playing = true; + // } + // var newProperties = { + // visible: data.visible == false ? false : true, + // collisionless: collisionless, + // userData: JSON.stringify(data), + // }; + // Entities.editEntity(entityID, newProperties); + //}); } function hideEntitiesWithTags(tags) { @@ -306,22 +305,22 @@ function hideEntitiesWithTag(tag) { } } - // Dynamic method, suppressed for now return; - editEntitiesWithTag(tag, function(entityID) { - var userData = Entities.getEntityProperties(entityID, "userData").userData; - var data = parseJSON(userData); - if (data.soundKey) { - data.soundKey.playing = false; - } - var newProperties = { - visible: false, - collisionless: 1, - ignoreForCollisions: 1, - userData: JSON.stringify(data), - }; - Entities.editEntity(entityID, newProperties); - }); + // Dynamic method, suppressed for now + //editEntitiesWithTag(tag, function(entityID) { + // var userData = Entities.getEntityProperties(entityID, "userData").userData; + // var data = parseJSON(userData); + // if (data.soundKey) { + // data.soundKey.playing = false; + // } + // var newProperties = { + // visible: false, + // collisionless: 1, + // ignoreForCollisions: 1, + // userData: JSON.stringify(data), + // }; + // Entities.editEntity(entityID, newProperties); + //}); } /** diff --git a/tutorial/tutorialEntityIDs.js b/tutorial/tutorialEntityIDs.js index a9b7962ca7..0200c2c247 100644 --- a/tutorial/tutorialEntityIDs.js +++ b/tutorial/tutorialEntityIDs.js @@ -114,11 +114,6 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = { "tag": "equip-part2" } }, - //"turnAround": { - // "{ce74b3ca-d1c7-4980-bd98-2d488095a39e}": { - // "tag": "turnAround" - // } - //}, "bothGrab": { "{14792a6e-dc6f-4e7a-843f-4b109b06b5a4}": { "visible": false,