Cleanup tutorial scripts

This commit is contained in:
Ryan Huffman 2016-12-16 16:01:44 -08:00
parent 46d8130782
commit 9730d07f59
3 changed files with 41 additions and 55 deletions

View file

@ -12,23 +12,15 @@
/* eslint camelcase: ["error", { "properties": "never" }] */ /* eslint camelcase: ["error", { "properties": "never" }] */
var leftBaseRotation = Quat.multiply( var leftBaseRotation = Quat.multiply(
Quat.fromPitchYawRollDegrees(0, 0, 0),
Quat.multiply(
Quat.fromPitchYawRollDegrees(-90, 0, 0), Quat.fromPitchYawRollDegrees(-90, 0, 0),
Quat.fromPitchYawRollDegrees(0, 0, 90) Quat.fromPitchYawRollDegrees(0, 0, 90)
)
); );
//var leftBaseRotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
var rightBaseRotation = Quat.multiply( var rightBaseRotation = Quat.multiply(
Quat.fromPitchYawRollDegrees(0, 0, 0),
Quat.multiply(
Quat.fromPitchYawRollDegrees(-90, 0, 0), Quat.fromPitchYawRollDegrees(-90, 0, 0),
Quat.fromPitchYawRollDegrees(0, 0, -90) 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_LENGTH_OFFSET = 0.0762;
var CONTROLLER_LATERAL_OFFSET = 0.0381; var CONTROLLER_LATERAL_OFFSET = 0.0381;
var CONTROLLER_VERTICAL_OFFSET = 0.0381; var CONTROLLER_VERTICAL_OFFSET = 0.0381;

View file

@ -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) { function spawn(entityPropertiesList, transform, modifyFn) {
debug("Creating: ", entityPropertiesList);
if (!transform) { if (!transform) {
transform = { transform = {
position: { x: 0, y: 0, z: 0 }, position: { x: 0, y: 0, z: 0 },
@ -139,7 +140,6 @@ function spawn(entityPropertiesList, transform, modifyFn) {
var ids = []; var ids = [];
for (var i = 0; i < entityPropertiesList.length; ++i) { for (var i = 0; i < entityPropertiesList.length; ++i) {
var data = entityPropertiesList[i]; var data = entityPropertiesList[i];
debug("Creating: ", data.name);
data.position = Vec3.sum(transform.position, data.position); data.position = Vec3.sum(transform.position, data.position);
data.rotation = Quat.multiply(data.rotation, transform.rotation); data.rotation = Quat.multiply(data.rotation, transform.rotation);
if (modifyFn) { if (modifyFn) {
@ -147,7 +147,6 @@ function spawn(entityPropertiesList, transform, modifyFn) {
} }
var id = Entities.addEntity(data); var id = Entities.addEntity(data);
ids.push(id); ids.push(id);
debug(id, "data:", JSON.stringify(data));
} }
return ids; return ids;
} }
@ -258,25 +257,25 @@ function showEntitiesWithTag(tag) {
debug("ERROR | No entities for tag: ", tag); debug("ERROR | No entities for tag: ", tag);
} }
// Dynamic method, suppressed for now
return; return;
editEntitiesWithTag(tag, function(entityID) { // Dynamic method, suppressed for now
var userData = Entities.getEntityProperties(entityID, "userData").userData; //editEntitiesWithTag(tag, function(entityID) {
var data = parseJSON(userData); // var userData = Entities.getEntityProperties(entityID, "userData").userData;
var collisionless = data.visible === false ? true : false; // var data = parseJSON(userData);
if (data.collidable !== undefined) { // var collisionless = data.visible === false ? true : false;
collisionless = data.collidable === true ? false : true; // if (data.collidable !== undefined) {
} // collisionless = data.collidable === true ? false : true;
if (data.soundKey) { // }
data.soundKey.playing = true; // if (data.soundKey) {
} // data.soundKey.playing = true;
var newProperties = { // }
visible: data.visible == false ? false : true, // var newProperties = {
collisionless: collisionless, // visible: data.visible == false ? false : true,
userData: JSON.stringify(data), // collisionless: collisionless,
}; // userData: JSON.stringify(data),
Entities.editEntity(entityID, newProperties); // };
}); // Entities.editEntity(entityID, newProperties);
//});
} }
function hideEntitiesWithTags(tags) { function hideEntitiesWithTags(tags) {
@ -306,22 +305,22 @@ function hideEntitiesWithTag(tag) {
} }
} }
// Dynamic method, suppressed for now
return; return;
editEntitiesWithTag(tag, function(entityID) { // Dynamic method, suppressed for now
var userData = Entities.getEntityProperties(entityID, "userData").userData; //editEntitiesWithTag(tag, function(entityID) {
var data = parseJSON(userData); // var userData = Entities.getEntityProperties(entityID, "userData").userData;
if (data.soundKey) { // var data = parseJSON(userData);
data.soundKey.playing = false; // if (data.soundKey) {
} // data.soundKey.playing = false;
var newProperties = { // }
visible: false, // var newProperties = {
collisionless: 1, // visible: false,
ignoreForCollisions: 1, // collisionless: 1,
userData: JSON.stringify(data), // ignoreForCollisions: 1,
}; // userData: JSON.stringify(data),
Entities.editEntity(entityID, newProperties); // };
}); // Entities.editEntity(entityID, newProperties);
//});
} }
/** /**

View file

@ -114,11 +114,6 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = {
"tag": "equip-part2" "tag": "equip-part2"
} }
}, },
//"turnAround": {
// "{ce74b3ca-d1c7-4980-bd98-2d488095a39e}": {
// "tag": "turnAround"
// }
//},
"bothGrab": { "bothGrab": {
"{14792a6e-dc6f-4e7a-843f-4b109b06b5a4}": { "{14792a6e-dc6f-4e7a-843f-4b109b06b5a4}": {
"visible": false, "visible": false,