From e9099b77a51020fd9e214471d04d8010c5585a1d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 11 Oct 2016 16:44:08 -0700 Subject: [PATCH 01/22] Add more debug to tutorial, new firecrackers, and adjust fuse --- .../system/controllers/controllerDisplay.js | 20 ++- tutorial/entityData.js | 33 ++-- tutorial/firePit/fire.js | 29 ++- tutorial/fuse.js | 33 +++- tutorial/fuseCollider.js | 5 +- tutorial/tutorial.js | 170 +++++++++++------- tutorial/tutorialEntityIDs.js | 166 ++++++++++++++++- 7 files changed, 356 insertions(+), 100 deletions(-) diff --git a/scripts/system/controllers/controllerDisplay.js b/scripts/system/controllers/controllerDisplay.js index f42ac3aeda..96ee955d19 100644 --- a/scripts/system/controllers/controllerDisplay.js +++ b/scripts/system/controllers/controllerDisplay.js @@ -31,14 +31,26 @@ function resolveHardware(path) { return resolveInner(Controller.Hardware, parts, 0); } +var DEBUG = true; +function debug() { + if (DEBUG) { + var args = Array.prototype.slice.call(arguments); + args.unshift("controllerDisplay.js | "); + print.apply(this, args); + } +} + createControllerDisplay = function(config) { var controllerDisplay = { overlays: [], - partOverlays: {}, - parts: {}, - mappingName: "mapping-display", + partOverlays: { + }, + parts: { + }, + mappingName: "mapping-display-" + Math.random(), setVisible: function(visible) { + debug("Setting visible", this.overlays.length); for (var i = 0; i < this.overlays.length; ++i) { Overlays.editOverlay(this.overlays[i], { visible: visible @@ -166,7 +178,7 @@ createControllerDisplay = function(config) { } else if (part.type === "static") { // do nothing } else { - print("TYPE NOT SUPPORTED: ", part.type); + debug("TYPE NOT SUPPORTED: ", part.type); } controllerDisplay.overlays.push(overlayID); diff --git a/tutorial/entityData.js b/tutorial/entityData.js index 76eb4d98ed..407e6e6b00 100644 --- a/tutorial/entityData.js +++ b/tutorial/entityData.js @@ -1,12 +1,13 @@ -birdFirework1 = { - "clientOnly": 0, - "collisionsWillMove": 1, - "created": "2016-09-13T23:05:08Z", - "dimensions": { - "x": 0.10120716691017151, - "y": 0.12002291530370712, - "z": 0.18833979964256287 - }, +fireworkURLs = [ + "atp:/tutorial_models/bomb1.fbx", + "atp:/tutorial_models/bomb2.fbx", + "atp:/tutorial_models/bomb3.fbx", + "atp:/tutorial_models/bomb4.fbx", + "atp:/tutorial_models/bomb5.fbx", + "atp:/tutorial_models/bomb6.fbx", +]; + +fireworkBaseProps = { "collisionsWillMove": 1, velocity: { x: 0, @@ -20,7 +21,7 @@ birdFirework1 = { "z": 0 }, "id": "{1c4061bc-b2e7-4435-bc47-3fcc39ae6624}", - "modelURL": "atp:/tutorial_models/birdStatue15.fbx", + "modelURL": "atp:/tutorial_models/bomb1.fbx", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "x": 0.11612319946289062, @@ -44,15 +45,8 @@ birdFirework1 = { "userData": "{\n \"hifiHomeKey\": {\n \"reset\": true\n }\n}" } ; + birdFirework2 = { - "clientOnly": 0, - "collisionsWillMove": 1, - "created": "2016-09-12T22:56:48Z", - "dimensions": { - "x": 0.098819166421890259, - "y": 0.11143554747104645, - "z": 0.18833979964256287 - }, "collisionsWillMove": 1, velocity: { x: 0, @@ -66,7 +60,8 @@ birdFirework2 = { "z": 0 }, "id": "{ba067084-8d0f-4eeb-a8a1-c6814527c1bb}", - "modelURL": "atp:/tutorial_models/statuebird4.fbx", + //"modelURL": "atp:/tutorial_models/statuebird4.fbx", + "modelURL": "atp:/tutorial_models/bomb2.fbx", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { "x": 0, diff --git a/tutorial/firePit/fire.js b/tutorial/firePit/fire.js index 077d79a42a..4565975351 100644 --- a/tutorial/firePit/fire.js +++ b/tutorial/firePit/fire.js @@ -4,6 +4,12 @@ (function() { + function debug() { + var args = Array.prototype.slice.call(arguments); + args.unshift("fire.js | "); + print.apply(this, args); + } + var _this = this; function Fire() { @@ -54,30 +60,45 @@ var colors = [RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET]; + var firePitSoundURL = Script.resolvePath("fire_burst.wav"); + debug("Firepit burst sound url is: ", firePitSoundURL); + + var explodeTextureURL = Script.resolvePath("explode.png"); + debug("Firepit explode texture url is: ", explodeTextureURL); + Fire.prototype = { preload: function(entityID) { + debug("Preload"); this.entityID = entityID; - this.EXPLOSION_SOUND = SoundCache.getSound("atp:/firepit/fire_burst.wav"); + this.EXPLOSION_SOUND = SoundCache.getSound(firePitSoundURL); }, collisionWithEntity: function(myID, otherID, collisionInfo) { + debug("Collided with entity: ", myID, otherID); var otherProps = Entities.getEntityProperties(otherID); var data = null; try { - data = JSON.parse(otherProps.userData) + data = JSON.parse(otherProps.userData); } catch (err) { - print('ERROR GETTING USERDATA!'); + debug('ERROR GETTING USERDATA!'); } if (data === null || "") { + debug("Data is null or empty", data); return; } else { + debug("Got data", data); if (data.hasOwnProperty('hifiHomeKey')) { + debug("Has hifiHomeKey"); if (data.hifiHomeKey.reset === true) { + debug("Reset is true"); _this.playSoundAtCurrentPosition(); _this.explodeWithColor(); Entities.deleteEntity(otherID) + debug("Sending local message"); Messages.sendLocalMessage('Entity-Exploded', JSON.stringify({ entityID: otherID, + position: Entities.getEntityProperties(this.entityID).position })); + debug("Done sending local message"); } } } @@ -137,7 +158,7 @@ "alphaStart": -0.2, "alphaFinish": 0.5, "emitterShouldTrail": 0, - "textures": "atp:/firepit/explode.png", + "textures": explodeTextureURL, "type": "ParticleEffect", lifetime: 1, position: myProps.position diff --git a/tutorial/fuse.js b/tutorial/fuse.js index 842695d85c..30afd49620 100644 --- a/tutorial/fuse.js +++ b/tutorial/fuse.js @@ -14,10 +14,14 @@ var DEBUG = false; function debug() { if (DEBUG) { - print.apply(self, arguments); + var args = Array.prototype.slice.call(arguments); + args.unshift("fuse.js | "); + print.apply(this, args); } } + var active = false; + var fuseSound = SoundCache.getSound("atp:/tutorial_sounds/fuse.wav"); function getChildProperties(entityID, propertyNames) { var childEntityIDs = Entities.getChildrenIDs(entityID); @@ -33,12 +37,20 @@ }; Fuse.prototype = { light: function() { - debug("LIT", this.entityID); - var anim = Entities.getEntityProperties(this.entityID, ['animation']).animation; + debug("Received light()", this.entityID); - if (anim.currentFrame < 140) { + var visible = Entities.getEntityProperties(this.entityID, ['visible']).visible; + if (!visible) { + debug("Fuse is not visible, returning"); return; } + + if (active) { + debug("Fuse is active, returning"); + return; + } + active = true; + Entities.editEntity(this.entityID, { animation: { currentFrame: 1, @@ -56,6 +68,7 @@ var childrenProps = getChildProperties(this.entityID, ['type']); for (var childEntityID in childrenProps) { + debug("Updating: ", childEntityID); var props = childrenProps[childEntityID]; if (props.type == "ParticleEffect") { Entities.editEntity(childEntityID, { @@ -70,13 +83,15 @@ var self = this; Script.setTimeout(function() { - debug("BLOW UP"); - var spinnerID = Utils.findEntity({ name: "tutorial/equip/spinner" }, 20); + debug("Setting off fireworks"); + //var spinnerID = Utils.findEntity({ name: "tutorial/equip/spinner" }, 20); + var spinnerID = "{dd13fcd5-616f-4749-ab28-2e1e8bc512e9}"; Entities.callEntityMethod(spinnerID, "onLit"); injector.stop(); var childrenProps = getChildProperties(self.entityID, ['type']); for (var childEntityID in childrenProps) { + debug("Updating: ", childEntityID); var props = childrenProps[childEntityID]; if (props.type == "ParticleEffect") { Entities.editEntity(childEntityID, { @@ -90,8 +105,14 @@ } }, 4900); + + Script.setTimeout(function() { + debug("Setting fuse to inactive"); + active = false; + }, 10000); }, preload: function(entityID) { + debug("Preload"); this.entityID = entityID; }, }; diff --git a/tutorial/fuseCollider.js b/tutorial/fuseCollider.js index 0ad5cfb371..7e000290d6 100644 --- a/tutorial/fuseCollider.js +++ b/tutorial/fuseCollider.js @@ -5,8 +5,9 @@ }; Fuse.prototype = { onLit: function() { - print("LIT", this.entityID); - var fuseID = Utils.findEntity({ name: "tutorial/equip/fuse" }, 20); + print("fuseCollider.js | Lit", this.entityID); + //var fuseID = Utils.findEntity({ name: "tutorial/equip/fuse" }, 20); + var fuseID = "{c8944a13-9acb-4d77-b1ee-851845e98357}" Entities.callEntityMethod(fuseID, "light"); }, preload: function(entityID) { diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 8c74bddc29..b2258c42fc 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -32,7 +32,7 @@ if (!Function.prototype.bind) { if (this.prototype) { // Function.prototype doesn't have a prototype property - fNOP.prototype = this.prototype; + fNOP.prototype = this.prototype; } fBound.prototype = new fNOP(); @@ -40,26 +40,36 @@ if (!Function.prototype.bind) { }; } -var DEBUG = false; +var DEBUG = true; function debug() { if (DEBUG) { - print.apply(this, arguments); + var args = Array.prototype.slice.call(arguments); + args.unshift("tutorial.js | "); + print.apply(this, args); } } var INFO = true; function info() { if (INFO) { - print.apply(this, arguments); + var args = Array.prototype.slice.call(arguments); + args.unshift("tutorial.js | "); + print.apply(this, args); } } +// Return a number between min (inclusive) and max (exclusive) +function randomInt(min, max) { + return min + Math.floor(Math.random() * (max - min)) +} + var NEAR_BOX_SPAWN_NAME = "tutorial/nearGrab/box_spawn"; var FAR_BOX_SPAWN_NAME = "tutorial/farGrab/box_spawn"; var GUN_SPAWN_NAME = "tutorial/gun_spawn"; var TELEPORT_PAD_NAME = "tutorial/teleport/pad" var successSound = SoundCache.getSound("atp:/tutorial_sounds/good_one.L.wav"); +var firecrackerSound = SoundCache.getSound("atp:/tutorial_sounds/Pops_Firecracker.wav"); var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable"; @@ -205,7 +215,7 @@ function findEntitiesWithTag(tag) { return findEntities({ userData: "" }, 10000, function(properties, key, value) { data = parseJSON(value); return data.tag == tag; - }); + }); } // From http://stackoverflow.com/questions/5999998/how-can-i-check-if-a-javascript-variable-is-function-type @@ -222,6 +232,15 @@ function playSuccessSound() { }); } + +function playFirecrackerSound(position) { + Audio.playSound(firecrackerSound, { + position: position, + volume: 0.7, + loop: false + }); +} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // @@ -340,13 +359,11 @@ stepOrient.prototype = { var tag = this.tag; // Spawn content set - debug("raise hands...", this.tag); editEntitiesWithTag(this.tag, { visible: true }); - this.checkIntervalID = null; function checkForHandsAboveHead() { - debug("Orient: Checking for hands above head..."); + debug("Orient | Checking for hands above head"); if (MyAvatar.getLeftPalmPosition().y > (MyAvatar.getHeadPosition().y + 0.1)) { Script.clearInterval(this.checkIntervalID); this.checkIntervalID = null; @@ -359,6 +376,7 @@ stepOrient.prototype = { this.checkIntervalID = Script.setInterval(checkForHandsAboveHead.bind(this), 500); }, cleanup: function() { + debug("Orient | Cleanup"); if (this.active) { this.active = false; } @@ -394,13 +412,12 @@ stepRaiseAboveHead.prototype = { var STATE_HANDS_UP = 2; this.state = STATE_START; - debug("raise hands...", this.tag); editEntitiesWithTag(this.tag, { visible: true }); // Wait 2 seconds before starting to check for hands this.checkIntervalID = null; function checkForHandsAboveHead() { - debug("Raise above head: Checking hands..."); + debug("RaiseAboveHead | Checking hands"); if (this.state == STATE_START) { if (MyAvatar.getLeftPalmPosition().y < (MyAvatar.getHeadPosition().y - 0.1)) { this.state = STATE_HANDS_DOWN; @@ -418,6 +435,7 @@ stepRaiseAboveHead.prototype = { this.checkIntervalID = Script.setInterval(checkForHandsAboveHead.bind(this), 500); }, cleanup: function() { + debug("RaiseAboveHead | Cleanup"); if (this.checkIntervalID) { Script.clearInterval(this.checkIntervalID); this.checkIntervalID = null @@ -459,22 +477,18 @@ stepNearGrab.prototype = { showEntitiesWithTag(this.tag, { visible: true }); showEntitiesWithTag('bothGrab', { visible: true }); - var boxSpawnID = findEntity({ name: NEAR_BOX_SPAWN_NAME }, 10000); - if (!boxSpawnID) { - info("Error creating block, cannot find spawn"); - return null; - } - var boxSpawnPosition = Entities.getEntityProperties(boxSpawnID, 'position').position; - function createBlock() { - //Step1BlockData.position = boxSpawnPosition; - birdFirework1.position = boxSpawnPosition; - return spawnWithTag([birdFirework1], null, this.tempTag)[0]; + var boxSpawnPosition = getEntityWithName(NEAR_BOX_SPAWN_NAME).position; + function createBlock(fireworkNumber) { + fireworkBaseProps.position = boxSpawnPosition; + fireworkBaseProps.modelURL = fireworkURLs[fireworkNumber % fireworkURLs.length]; + debug("Creating firework with url: ", fireworkBaseProps.modelURL); + return spawnWithTag([fireworkBaseProps], null, this.tempTag)[0]; } this.birdIDs = []; - this.birdIDs.push(createBlock.bind(this)()); - this.birdIDs.push(createBlock.bind(this)()); - this.birdIDs.push(createBlock.bind(this)()); + this.birdIDs.push(createBlock.bind(this)(0)); + this.birdIDs.push(createBlock.bind(this)(1)); + this.birdIDs.push(createBlock.bind(this)(2)); this.positionWatcher = new PositionWatcher(this.birdIDs, boxSpawnPosition, -0.4, 4); }, onMessage: function(channel, message, seneder) { @@ -482,10 +496,12 @@ stepNearGrab.prototype = { return; } if (channel == "Entity-Exploded") { - debug("TUTORIAL: Got entity-exploded message"); + debug("NearGrab | Got entity-exploded message: ", message); var data = parseJSON(message); if (this.birdIDs.indexOf(data.entityID) >= 0) { + debug("NearGrab | It's one of the firecrackers"); + playFirecrackerSound(data.position); playSuccessSound(); this.finished = true; this.onFinish(); @@ -493,7 +509,7 @@ stepNearGrab.prototype = { } }, cleanup: function() { - debug("cleaning up near grab"); + debug("NearGrab | Cleanup"); this.finished = true; setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); @@ -540,21 +556,18 @@ stepFarGrab.prototype = { // Spawn content set showEntitiesWithTag(this.tag); - var boxSpawnID = findEntity({ name: FAR_BOX_SPAWN_NAME }, 10000); - if (!boxSpawnID) { - debug("Error creating block, cannot find spawn"); - return null; - } - var boxSpawnPosition = Entities.getEntityProperties(boxSpawnID, 'position').position; - function createBlock() { - birdFirework1.position = boxSpawnPosition; - return spawnWithTag([birdFirework1], null, this.tempTag)[0]; + var boxSpawnPosition = getEntityWithName(FAR_BOX_SPAWN_NAME).position; + function createBlock(fireworkNumber) { + fireworkBaseProps.position = boxSpawnPosition; + fireworkBaseProps.modelURL = fireworkURLs[fireworkNumber % fireworkURLs.length]; + debug("Creating firework with url: ", fireworkBaseProps.modelURL); + return spawnWithTag([fireworkBaseProps], null, this.tempTag)[0]; } this.birdIDs = []; - this.birdIDs.push(createBlock.bind(this)()); - this.birdIDs.push(createBlock.bind(this)()); - this.birdIDs.push(createBlock.bind(this)()); + this.birdIDs.push(createBlock.bind(this)(3)); + this.birdIDs.push(createBlock.bind(this)(4)); + this.birdIDs.push(createBlock.bind(this)(5)); this.positionWatcher = new PositionWatcher(this.birdIDs, boxSpawnPosition, -0.4, 4); }, onMessage: function(channel, message, seneder) { @@ -562,9 +575,11 @@ stepFarGrab.prototype = { return; } if (channel == "Entity-Exploded") { - debug("TUTORIAL: Got entity-exploded message"); + debug("FarGrab | Got entity-exploded message: ", message); var data = parseJSON(message); if (this.birdIDs.indexOf(data.entityID) >= 0) { + debug("FarGrab | It's one of the firecrackers"); + playFirecrackerSound(data.position); playSuccessSound(); this.finished = true; this.onFinish(); @@ -572,6 +587,7 @@ stepFarGrab.prototype = { } }, cleanup: function() { + debug("FarGrab | Cleanup"); this.finished = true; setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); @@ -586,12 +602,13 @@ stepFarGrab.prototype = { }; function PositionWatcher(entityIDs, originalPosition, minY, maxDistance) { + debug("Creating position watcher"); this.watcherIntervalID = Script.setInterval(function() { for (var i = 0; i < entityIDs.length; ++i) { var entityID = entityIDs[i]; var props = Entities.getEntityProperties(entityID, ['position']); if (props.position.y < minY || Vec3.distance(originalPosition, props.position) > maxDistance) { - Entities.editEntity(entityID, { + Entities.editEntity(entityID, { position: originalPosition, velocity: { x: 0, y: -0.01, z: 0 }, angularVelocity: { x: 0, y: 0, z: 0 } @@ -603,6 +620,7 @@ function PositionWatcher(entityIDs, originalPosition, minY, maxDistance) { PositionWatcher.prototype = { destroy: function() { + debug("Destroying position watcher"); Script.clearInterval(this.watcherIntervalID); } }; @@ -644,40 +662,47 @@ stepEquip.prototype = { this.currentPart = this.PART1; - function createGun() { - var boxSpawnID = findEntity({ name: GUN_SPAWN_NAME }, 10000); - if (!boxSpawnID) { - info("Error creating block, cannot find spawn"); - return null; - } + function createLighter() { + //var boxSpawnID = findEntity({ name: GUN_SPAWN_NAME }, 10000); + //if (!boxSpawnID) { + //info("Error creating block, cannot find spawn"); + //return null; + //} var transform = {}; - transform.position = Entities.getEntityProperties(boxSpawnID, 'position').position; - transform.rotation = Entities.getEntityProperties(boxSpawnID, 'rotation').rotation; + var boxSpawnProps = getEntityWithName(GUN_SPAWN_NAME); + transform.position = boxSpawnProps.position; + transform.rotation = boxSpawnProps.rotation; + transform.velocity = { x: 0, y: -0.01, z: 0 }; + transform.angularVelocity = { x: 0, y: 0, z: 0 }; this.spawnTransform = transform; return doCreateButaneLighter(transform).id; } - this.gunID = createGun.bind(this)(); - this.startWatchingGun(); - debug("Created", this.gunID); + this.lighterID = createLighter.bind(this)(); + this.startWatchingLighter(); + debug("Created lighter", this.lighterID); this.onFinish = onFinish; }, - startWatchingGun: function() { + startWatchingLighter: function() { if (!this.watcherIntervalID) { + debug("Starting to watch lighter position"); this.watcherIntervalID = Script.setInterval(function() { - var props = Entities.getEntityProperties(this.gunID, ['position']); - if (props.position.y < -0.4 + debug("Checking lighter position"); + var props = Entities.getEntityProperties(this.lighterID, ['position']); + if (props.position.y < -0.4 || Vec3.distance(this.spawnTransform.position, props.position) > 4) { - Entities.editEntity(this.gunID, this.spawnTransform); + debug("Moving lighter back to table"); + Entities.editEntity(this.lighterID, this.spawnTransform); } }.bind(this), 1000); } }, stopWatchingGun: function() { if (this.watcherIntervalID) { + debug("Stopping watch of lighter position"); Script.clearInterval(this.watcherIntervalID); this.watcherIntervalID = null; } @@ -687,24 +712,27 @@ stepEquip.prototype = { return; } - debug("Got message", channel, message, sender, MyAvatar.sessionUUID); + debug("Equip | Got message", channel, message, sender, MyAvatar.sessionUUID); if (channel == "Tutorial-Spinner") { if (this.currentPart == this.PART1 && message == "wasLit") { this.currentPart = this.PART2; + debug("Equip | Starting part 2"); Script.setTimeout(function() { + debug("Equip | Starting part 3"); this.currentPart = this.PART3; hideEntitiesWithTag(this.tagPart1); showEntitiesWithTag(this.tagPart2); setControllerPartLayer('tips', 'grip'); Messages.subscribe('Hifi-Object-Manipulation'); + debug("Equip | Finished starting part 3"); }.bind(this), 9000); } } else if (channel == "Hifi-Object-Manipulation") { if (this.currentPart == this.PART3) { var data = parseJSON(message); - if (data.action == 'release' && data.grabbedEntity == this.gunID) { - info("got release"); + if (data.action == 'release' && data.grabbedEntity == this.lighterID) { + debug("Equip | Got release, finishing step"); this.stopWatchingGun(); this.currentPart = this.COMPLETE; playSuccessSound(); @@ -714,6 +742,7 @@ stepEquip.prototype = { } }, cleanup: function() { + debug("Equip | Got yaw action"); if (this.watcherIntervalID) { Script.clearInterval(this.watcherIntervalID); this.watcherIntervalID = null; @@ -764,6 +793,7 @@ stepTurnAround.prototype = { Controller.actionEvent.connect(this.onActionBound); this.interval = Script.setInterval(function() { + debug("TurnAround | Checking if finished", this.numTimesTurnPressed); var FORWARD_THRESHOLD = 30; var REQ_NUM_TIMES_PRESSED = 6; @@ -782,10 +812,12 @@ stepTurnAround.prototype = { onAction: function(action, value) { var STEP_YAW_ACTION = 6; if (action == STEP_YAW_ACTION && value != 0) { + debug("TurnAround | Got yaw action"); this.numTimesTurnPressed += 1; } }, cleanup: function() { + debug("TurnAround | Cleanup"); try { Controller.actionEvent.disconnect(this.onActionBound); } catch (e) { @@ -826,22 +858,23 @@ stepTeleport.prototype = { Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none'); // Wait until touching teleport pad... - var padID = findEntity({ name: TELEPORT_PAD_NAME }, 100); - var padProps = Entities.getEntityProperties(padID, ["position", "dimensions"]); + //var padID = findEntity({ name: TELEPORT_PAD_NAME }, 100); + //var padProps = Entities.getEntityProperties(padID, ["position", "dimensions"]); + var padProps = getEntityWithName(TELEPORT_PAD_NAME); var xMin = padProps.position.x - padProps.dimensions.x / 2; var xMax = padProps.position.x + padProps.dimensions.x / 2; var zMin = padProps.position.z - padProps.dimensions.z / 2; var zMax = padProps.position.z + padProps.dimensions.z / 2; function checkCollides() { - debug("Checking if on pad..."); + debug("Teleport | Checking if on pad..."); var pos = MyAvatar.position; - debug('x', pos.x, xMin, xMax); - debug('z', pos.z, zMin, zMax); + debug('Teleport | x', pos.x, xMin, xMax); + debug('Teleport | z', pos.z, zMin, zMax); if (pos.x > xMin && pos.x < xMax && pos.z > zMin && pos.z < zMax) { - debug("On teleport pad"); + debug("Teleport | On teleport pad"); Script.clearInterval(this.checkCollidesTimer); this.checkCollidesTimer = null; playSuccessSound(); @@ -853,6 +886,7 @@ stepTeleport.prototype = { showEntitiesWithTag(this.tag); }, cleanup: function() { + debug("Teleport | Cleanup"); setControllerPartLayer('touchpad', 'blank'); setControllerPartLayer('tips', 'blank'); @@ -982,6 +1016,13 @@ function hideEntitiesWithTag(tag) { }); } +// Return the entity properties for an entity with a given name if it is in our +// cached list of entities. Otherwise, return undefined. +function getEntityWithName(name) { + debug("Getting entity with name:", name); + return TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP[name]; +} + TutorialManager = function() { var STEPS; @@ -1000,7 +1041,7 @@ TutorialManager = function() { STEPS = [ new stepDisableControllers("step0"), new stepOrient("orient"), - new stepRaiseAboveHead("raiseHands"), + //new stepRaiseAboveHead("raiseHands"), new stepNearGrab("nearGrab"), new stepFarGrab("farGrab"), new stepEquip("equip"), @@ -1017,6 +1058,7 @@ TutorialManager = function() { } this.onFinish = function() { + debug("onFinish", currentStepNum); if (currentStep && currentStep.shouldLog !== false) { var timeToFinishStep = (Date.now() - startedLastStepAt) / 1000; var tutorialTimeElapsed = (Date.now() - startedTutorialAt) / 1000; diff --git a/tutorial/tutorialEntityIDs.js b/tutorial/tutorialEntityIDs.js index 38bd06e5ff..886913a838 100644 --- a/tutorial/tutorialEntityIDs.js +++ b/tutorial/tutorialEntityIDs.js @@ -148,4 +148,168 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = { "tag": "orient" } } -} +}; + +TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP = { + "tutorial/gun_spawn": { + "userData": "{\"tag\":\"equip\",\"visible\":false}", + "dimensions": { + "y": 0.0649842768907547, + "x": 0.0649842768907547, + "z": 0.0649842768907547 + }, + "collisionless": 1, + "created": "2016-09-08T18:38:24Z", + "color": { + "blue": 0, + "green": 0, + "red": 255 + }, + "queryAACube": { + "y": 0.6283726096153259, + "x": 0.6865367293357849, + "scale": 0.11255607008934021, + "z": 0.3359576463699341 + }, + "visible": 0, + "shape": "Cube", + "clientOnly": 0, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "y": 0.6846506595611572, + "x": 0.7428147792816162, + "z": 0.3922356963157654 + }, + "rotation": { + "y": 0.7066605091094971, + "x": 0.7066605091094971, + "z": -0.025131583213806152, + "w": -0.025101065635681152 + }, + "ignoreForCollisions": 1, + "type": "Box", + "id": "{9df518da-9e65-4b76-8a79-eeefdb0b7310}", + "name": "tutorial/gun_spawn" + }, + "tutorial/nearGrab/box_spawn": { + "userData": "{\"tag\":\"nearGrab\",\"visible\":false}", + "dimensions": { + "y": 0.08225371688604355, + "x": 0.08225371688604355, + "z": 0.08225371688604355 + }, + "collisionless": 1, + "created": "2016-09-08T18:38:24Z", + "color": { + "blue": 255, + "green": 0, + "red": 255 + }, + "queryAACube": { + "y": 0.738319456577301, + "x": 0.8985498547554016, + "scale": 0.14246761798858643, + "z": 0.29067665338516235 + }, + "visible": 0, + "shape": "Cube", + "clientOnly": 0, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + "y": 0.8095532655715942, + "x": 0.9697836637496948, + "z": 0.36191046237945557 + }, + "rotation": { + "y": -1.52587890625e-05, + "x": -1.52587890625e-05, + "z": -1.52587890625e-05, + "w": 1 + }, + "ignoreForCollisions": 1, + "type": "Box", + "id": "{5cf22b9c-fb22-4854-8821-554422980b24}", + "name": "tutorial/nearGrab/box_spawn" + }, + "tutorial/farGrab/box_spawn": { + "userData": "{\"tag\":\"farGrab\",\"visible\":false}", + "dimensions": { + "y": 0.37358683347702026, + "x": 0.37358683347702026, + "z": 0.37358683347702026 + }, + "collisionless": 1, + "created": "2016-09-08T18:38:24Z", + "color": { + "blue": 255, + "green": 0, + "red": 255 + }, + "queryAACube": { + "y": 0.3304251432418823, + "x": 3.0951309204101562, + "scale": 0.647071361541748, + "z": 0.18027013540267944 + }, + "visible": 0, + "shape": "Cube", + "clientOnly": 0, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "position": { + x: 3.4866, + y: 0.6716, + z: 0.4789 + }, + "rotation": { + "y": -1.52587890625e-05, + "x": -1.52587890625e-05, + "z": -1.52587890625e-05, + "w": 1 + }, + "ignoreForCollisions": 1, + "type": "Box", + "id": "{70fcd96c-cd59-4f23-9ca5-a167f2f85680}", + "name": "tutorial/farGrab/box_spawn" + }, + "tutorial/teleport/pad": { + "userData": "{\"tag\":\"teleport\"}", + "rotation": { + "y": -0.9702650308609009, + "x": -2.1246911273919977e-05, + "z": -4.222852112434339e-06, + "w": 0.2420452982187271 + }, + "dimensions": { + "y": 0.4365682601928711, + "x": 2.1751723289489746, + "z": 2.175173044204712 + }, + "collisionless": 1, + "created": "2016-09-08T18:38:24Z", + "queryAACube": { + "y": -1.7979401350021362, + "x": 7.5136213302612305, + "scale": 3.106983184814453, + "z": -1.4602710008621216 + }, + "visible": 0, + "angularVelocity": { + "y": -0.5235987901687622, + "x": 0, + "z": 0 + }, + "clientOnly": 0, + "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", + "angularDamping": 0, + "position": { + "y": -0.2444484978914261, + "x": 9.067112922668457, + "z": 0.09322060644626617 + }, + "modelURL": "atp:/alan/dev/Teleport-Pad.fbx", + "ignoreForCollisions": 1, + "type": "Model", + "id": "{4478f7b5-d3ac-4213-9a7b-ad8cd69575b8}", + "name": "tutorial/teleport/pad" + } +}; From d9e6491843eaa7494466e5789d6cc8bb544c744d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 12 Oct 2016 10:37:38 -0700 Subject: [PATCH 02/22] Add more debug to fuseCollider and spinner --- tutorial/fuseCollider.js | 1 + tutorial/spinner.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tutorial/fuseCollider.js b/tutorial/fuseCollider.js index 7e000290d6..147444ac1d 100644 --- a/tutorial/fuseCollider.js +++ b/tutorial/fuseCollider.js @@ -11,6 +11,7 @@ Entities.callEntityMethod(fuseID, "light"); }, preload: function(entityID) { + print("fuseCollider.js | preload"); this.entityID = entityID; }, }; diff --git a/tutorial/spinner.js b/tutorial/spinner.js index b50db2704e..b27022fce2 100644 --- a/tutorial/spinner.js +++ b/tutorial/spinner.js @@ -31,7 +31,7 @@ } Spinner.prototype = { onLit: function() { - debug("LIT SPINNER", this.entityID); + debug("spinner.js | Spinner lit"); Entities.editEntity(this.entityID, { "angularDamping": 0.1, "angularVelocity": { @@ -50,6 +50,7 @@ for (var childEntityID in childrenProps) { var props = childrenProps[childEntityID]; if (props.type == "ParticleEffect") { + debug("spinner.js | Modifying: ", childEntityID); Entities.editEntity(childEntityID, { emitRate: 35, }); @@ -59,13 +60,14 @@ var self = this; Script.setTimeout(function() { - debug("BLOW UP"); + debug("spinner.js | Finishing spinner"); injector.stop(); var childrenProps = getChildProperties(self.entityID, ['type']); for (var childEntityID in childrenProps) { var props = childrenProps[childEntityID]; if (props.type == "ParticleEffect") { + debug("spinner.js | Modifying: ", childEntityID); Entities.editEntity(childEntityID, { emitRate: 0, }); @@ -74,6 +76,7 @@ }, 4900); }, preload: function(entityID) { + debug("spinner.js | Preload"); this.entityID = entityID; }, }; From 1f2b555a2647b74fb5fc44a90fd9ba6fa82e8a92 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Oct 2016 14:16:04 -0700 Subject: [PATCH 03/22] Add logging of show/hide/getByName in tutorial --- tutorial/tutorial.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index b2258c42fc..871d16a218 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -937,6 +937,10 @@ stepCleanupFinish.prototype = { +function isEntityInLocalTree(entityID) { + return Entities.getEntityProperties(entityID, 'visible').visible !== undefined; +} + function showEntitiesWithTag(tag) { var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag]; if (entities) { @@ -955,6 +959,7 @@ function showEntitiesWithTag(tag) { collisionless: collisionless, userData: JSON.stringify(data), }; + debug("Showing: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID)); Entities.editEntity(entityID, newProperties); } } @@ -979,6 +984,7 @@ function showEntitiesWithTag(tag) { Entities.editEntity(entityID, newProperties); }); } + function hideEntitiesWithTag(tag) { var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag]; if (entities) { @@ -994,6 +1000,8 @@ function hideEntitiesWithTag(tag) { ignoreForCollisions: 1, userData: JSON.stringify(data), }; + + debug("Hiding: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID)); Entities.editEntity(entityID, newProperties); } } @@ -1020,7 +1028,9 @@ function hideEntitiesWithTag(tag) { // cached list of entities. Otherwise, return undefined. function getEntityWithName(name) { debug("Getting entity with name:", name); - return TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP[name]; + var entityID = TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP[name]; + debug("Entity id: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID)); + return entityID; } From e58cd53fe57786715378de0e319550d434d955bf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Oct 2016 15:39:32 -0700 Subject: [PATCH 04/22] Fix entity id for grip button model --- tutorial/tutorialEntityIDs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial/tutorialEntityIDs.js b/tutorial/tutorialEntityIDs.js index 886913a838..14b2a69892 100644 --- a/tutorial/tutorialEntityIDs.js +++ b/tutorial/tutorialEntityIDs.js @@ -83,7 +83,7 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = { } }, "equip-part2": { - "{8b92eec5-aeed-4368-bce0-432cc9ad4c51}": { + "{b5d17eda-90ab-40cf-b973-efcecb2e992e}": { "tag": "equip-part2" }, "{6307cd16-dd1d-4988-a339-578178436b45}": { From 97fbdc7c2089ea9df4dd40d048076ba8f27bb327 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Oct 2016 16:52:43 -0700 Subject: [PATCH 05/22] Fix issues in several tutorial scripts --- tutorial/fuse.js | 4 ++-- tutorial/spinner.js | 4 ++-- tutorial/tutorialStartZone.js | 8 +++++++- tutorial/tutorialZone.js | 15 +++++++++++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tutorial/fuse.js b/tutorial/fuse.js index 30afd49620..73a3a697bd 100644 --- a/tutorial/fuse.js +++ b/tutorial/fuse.js @@ -11,7 +11,7 @@ (function() { Script.include('utils.js'); - var DEBUG = false; + var DEBUG = true; function debug() { if (DEBUG) { var args = Array.prototype.slice.call(arguments); @@ -109,7 +109,7 @@ Script.setTimeout(function() { debug("Setting fuse to inactive"); active = false; - }, 10000); + }, 14000); }, preload: function(entityID) { debug("Preload"); diff --git a/tutorial/spinner.js b/tutorial/spinner.js index b27022fce2..2edbb43700 100644 --- a/tutorial/spinner.js +++ b/tutorial/spinner.js @@ -9,10 +9,10 @@ // (function() { - var DEBUG = false; + var DEBUG = true; function debug() { if (DEBUG) { - print.apply(self, arguments); + print.apply(this, arguments); } } diff --git a/tutorial/tutorialStartZone.js b/tutorial/tutorialStartZone.js index 5cff1a4e99..81d4892919 100644 --- a/tutorial/tutorialStartZone.js +++ b/tutorial/tutorialStartZone.js @@ -20,7 +20,7 @@ print("TutorialStartZone | Parent ID is: ", parentID); if (parentID) { print("TutorialStartZone | Sending start"); - Entities.callEntityMethod(parentID, 'start'); + Entities.callEntityMethod(parentID, 'onEnteredStartZone'); } else { print("TutorialStartZone | ERROR: No parent id found on tutorial start zone"); } @@ -38,6 +38,12 @@ if (this.sendStartIntervalID) { Script.clearInterval(this.sendStartIntervalID); } + var parentID = Entities.getEntityProperties(this.entityID, 'parentID').parentID; + print("TutorialStartZone | Parent ID is: ", parentID); + if (parentID) { + print("TutorialStartZone | Sending onLeftStartZone"); + Entities.callEntityMethod(parentID, 'on'); + } } }; diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index db7306a529..6c78d678b4 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -59,11 +59,13 @@ if (!Function.prototype.bind) { print("TutorialZone | Preload"); this.entityID = entityID; }, - start: function() { - print("TutorialZone | Got start"); + onEnteredStartZone: function() { + print("TutorialZone | Got onEnteredStartZone"); var self = this; if (!this.token) { print("TutorialZone | Creating token"); + // The start zone has been entered, hide the overlays immediately + Menu.setIsOptionChecked("Overlays", false); this.token = new OwnershipToken(Math.random() * 100000, this.entityID, { onGainedOwnership: function(token) { print("TutorialZone | GOT OWNERSHIP"); @@ -91,6 +93,15 @@ if (!Function.prototype.bind) { }); } }, + onLeftStartZone: function() { + print("TutorialZone | Got onLeftStartZone"); + + // If the start zone was exited, and the tutorial hasn't started, go ahead and + // re-enable the HUD/Overlays + if (!self.tutorialManager) { + Menu.setIsOptionChecked("Overlays", true); + } + }, enterEntity: function() { print("TutorialZone | ENTERED THE TUTORIAL AREA"); From eb541e09f96d8a5efc738d3e0efa94491249d0a9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Oct 2016 13:15:23 -0700 Subject: [PATCH 06/22] Update tutorial error text to say 'Vive headset' instead of 'VR headset' --- tutorial/tutorialStartZone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial/tutorialStartZone.js b/tutorial/tutorialStartZone.js index 81d4892919..cb0d223200 100644 --- a/tutorial/tutorialStartZone.js +++ b/tutorial/tutorialStartZone.js @@ -29,7 +29,7 @@ sendStart(); } else { print("TutorialStartZone | User tried to go to tutorial with HMD and hand controllers, sending back to /"); - Window.alert("To proceed with this tutorial, please connect your VR headset and hand controllers."); + Window.alert("To proceed with this tutorial, please connect your Vive headset and hand controllers."); location = "/"; } }, From 1f25ba8f1ffa654365fd676cfbf7f892a0e9d5b3 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Oct 2016 14:05:06 -0700 Subject: [PATCH 07/22] Update controller tips and trigger highlight in tutorial --- .../viveControllerConfiguration.js | 29 +++++++++++++++++-- tutorial/tutorial.js | 11 +++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/viveControllerConfiguration.js b/scripts/system/controllers/viveControllerConfiguration.js index 341b8256f7..11fc774376 100644 --- a/scripts/system/controllers/viveControllerConfiguration.js +++ b/scripts/system/controllers/viveControllerConfiguration.js @@ -62,6 +62,7 @@ var TIP_TEXTURE_BASE_URL = BASE_URL + "meshes/controller/vive_tips.fbm/"; var viveModelURL = BASE_URL + "meshes/controller/vive_body.fbx"; var viveTipsModelURL = BASE_URL + "meshes/controller/vive_tips.fbx"; +var viveTriggerModelURL = "meshes/controller/vive_trigger.fbx" VIVE_CONTROLLER_CONFIGURATION_LEFT = { name: "Vive", @@ -86,7 +87,7 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = { defaultTextureLayer: "blank", textureLayers: { blank: { - defaultTextureURL: TIP_TEXTURE_BASE_URL + "Blank.png" + defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Blank.png" }, trigger: { defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Trigger.png" @@ -141,7 +142,18 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = { minValue: 0.0, maxValue: 1.0, axis: { x: -1, y: 0, z: 0 }, - maxAngle: 20 + maxAngle: 25, + + textureName: "Tex.black-trigger", + defaultTextureLayer: "normal", + textureLayers: { + normal: { + defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/black.jpg", + }, + highlight: { + defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", + } + } }, l_grip: { @@ -262,7 +274,18 @@ VIVE_CONTROLLER_CONFIGURATION_RIGHT = { minValue: 0.0, maxValue: 1.0, axis: { x: -1, y: 0, z: 0 }, - maxAngle: 25 + maxAngle: 25, + + textureName: "Tex.black-trigger", + defaultTextureLayer: "normal", + textureLayers: { + normal: { + defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/black.jpg", + }, + highlight: { + defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", + } + } }, l_grip: { diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 871d16a218..d666c39aae 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -254,6 +254,7 @@ var stepDisableControllers = function(name) { stepDisableControllers.prototype = { start: function(onFinish) { HMD.requestShowHandControllers(); + disableEverything(); onFinish(); @@ -277,6 +278,9 @@ function disableEverything() { setControllerPartLayer('tips', 'blank'); hideEntitiesWithTag('finish'); + + controllerDisplayManager = new ControllerDisplayManager(); + setAwayEnabled(false); } @@ -471,6 +475,7 @@ stepNearGrab.prototype = { setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); + setControllerPartLayer('trigger', 'highlight'); var tag = this.tag; // Spawn content set @@ -513,6 +518,7 @@ stepNearGrab.prototype = { this.finished = true; setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); + setControllerPartLayer('trigger', 'normal'); hideEntitiesWithTag(this.tag, { visible: false}); deleteEntitiesWithTag(this.tempTag); if (this.positionWatcher) { @@ -548,6 +554,7 @@ stepFarGrab.prototype = { setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); + setControllerPartLayer('trigger', 'highlight'); Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ farGrabEnabled: true, })); @@ -591,6 +598,7 @@ stepFarGrab.prototype = { this.finished = true; setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); + setControllerPartLayer('trigger', 'normal'); hideEntitiesWithTag(this.tag, { visible: false}); hideEntitiesWithTag('bothGrab', { visible: false}); deleteEntitiesWithTag(this.tempTag); @@ -650,6 +658,7 @@ stepEquip.prototype = { start: function(onFinish) { setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); + setControllerPartLayer('trigger', 'highlight'); Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ holdEnabled: true, })); @@ -723,6 +732,7 @@ stepEquip.prototype = { this.currentPart = this.PART3; hideEntitiesWithTag(this.tagPart1); showEntitiesWithTag(this.tagPart2); + setControllerPartLayer('trigger', 'normal'); setControllerPartLayer('tips', 'grip'); Messages.subscribe('Hifi-Object-Manipulation'); debug("Equip | Finished starting part 3"); @@ -750,6 +760,7 @@ stepEquip.prototype = { setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); + setControllerPartLayer('trigger', 'normal'); this.stopWatchingGun(); this.currentPart = this.COMPLETE; From 0234747ec3f478dfb414ed8ca75fa7d7497c784f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 17 Oct 2016 16:25:59 -0700 Subject: [PATCH 08/22] Update editEntitiesWithTag to use static lookup table --- tutorial/tutorial.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index d666c39aae..0f0a24356a 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -201,12 +201,18 @@ function deleteEntitiesWithTag(tag) { } } function editEntitiesWithTag(tag, propertiesOrFn) { - var entityIDs = findEntitiesWithTag(tag); - for (var i = 0; i < entityIDs.length; ++i) { - if (isFunction(propertiesOrFn)) { - Entities.editEntity(entityIDs[i], propertiesOrFn(entityIDs[i])); - } else { - Entities.editEntity(entityIDs[i], propertiesOrFn); + //var entityIDs = findEntitiesWithTag(tag); + var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag]; + + debug("Editing tag: ", tag); + if (entities) { + for (entityID in entities) { + debug("Editing: ", entityID, ", ", propertiesOrFn, ", Is in local tree: ", isEntityInLocalTree(entityID)); + if (isFunction(propertiesOrFn)) { + Entities.editEntity(entityID, propertiesOrFn(entityIDs[i])); + } else { + Entities.editEntity(entityID, propertiesOrFn); + } } } } From b9bc9bb802ae7bdbb5da391b96bcd97339726c78 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 17 Oct 2016 16:26:20 -0700 Subject: [PATCH 09/22] Update tutorial to disable away.js right away --- tutorial/ownershipToken.js | 2 ++ tutorial/tutorialZone.js | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tutorial/ownershipToken.js b/tutorial/ownershipToken.js index 745eee44e4..b76f3af1c2 100644 --- a/tutorial/ownershipToken.js +++ b/tutorial/ownershipToken.js @@ -185,3 +185,5 @@ OwnershipToken.prototype = { Script.setTimeout(checkOwnershipRequest.bind(this), 2000); }, }; + +debug("Returning from ownershipToken"); diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index 6c78d678b4..42565aa99b 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -27,10 +27,14 @@ if (!Function.prototype.bind) { } (function() { - var ownershipTokenPath = Script.resolvePath("ownershipToken.js"); - var tutorialPath = Script.resolvePath("tutorial.js"); - Script.include(ownershipTokenPath); - Script.include(tutorialPath); + Script.include("ownershipToken.js"); + Script.include("tutorial.js"); + + var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable"; + function setAwayEnabled(value) { + var message = value ? 'enable' : 'disable'; + Messages.sendLocalMessage(CHANNEL_AWAY_ENABLE, message); + } var TutorialZone = function() { print("TutorialZone | Creating"); @@ -65,7 +69,9 @@ if (!Function.prototype.bind) { if (!this.token) { print("TutorialZone | Creating token"); // The start zone has been entered, hide the overlays immediately + setAwayEnabled(false); Menu.setIsOptionChecked("Overlays", false); + MyAvatar.shouldRenderLocally = false; this.token = new OwnershipToken(Math.random() * 100000, this.entityID, { onGainedOwnership: function(token) { print("TutorialZone | GOT OWNERSHIP"); @@ -100,6 +106,8 @@ if (!Function.prototype.bind) { // re-enable the HUD/Overlays if (!self.tutorialManager) { Menu.setIsOptionChecked("Overlays", true); + MyAvatar.shouldRenderLocally = true; + setAwayEnabled(true); } }, From c0e372c3802b9f550d786dc076865afe7bbf340a Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 18 Oct 2016 08:49:00 -0700 Subject: [PATCH 10/22] Remove annotation API from controller display --- .../controllers/controllerDisplayManager.js | 1 - tutorial/tutorial.js | 20 ------------------- 2 files changed, 21 deletions(-) diff --git a/scripts/system/controllers/controllerDisplayManager.js b/scripts/system/controllers/controllerDisplayManager.js index 2c621f7e90..550357d659 100644 --- a/scripts/system/controllers/controllerDisplayManager.js +++ b/scripts/system/controllers/controllerDisplayManager.js @@ -69,7 +69,6 @@ ControllerDisplayManager = function() { } } - Messages.subscribe('Controller-Display'); var handleMessages = function(channel, message, sender) { var i, data, name, visible; if (!controllerLeft && !controllerRight) { diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 0f0a24356a..ea8dd792de 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -116,14 +116,6 @@ findEntities = function(properties, searchRadius, filterFn) { return matchedEntities; } -function setControllerVisible(name, visible) { - return; - Messages.sendLocalMessage('Controller-Display', JSON.stringify({ - name: name, - visible: visible, - })); -} - function setControllerPartsVisible(parts) { Messages.sendLocalMessage('Controller-Display-Parts', JSON.stringify(parts)); } @@ -479,7 +471,6 @@ stepNearGrab.prototype = { this.finished = false; this.onFinish = onFinish; - setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); setControllerPartLayer('trigger', 'highlight'); var tag = this.tag; @@ -522,7 +513,6 @@ stepNearGrab.prototype = { cleanup: function() { debug("NearGrab | Cleanup"); this.finished = true; - setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); setControllerPartLayer('trigger', 'normal'); hideEntitiesWithTag(this.tag, { visible: false}); @@ -558,7 +548,6 @@ stepFarGrab.prototype = { showEntitiesWithTag('bothGrab', { visible: true }); - setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); setControllerPartLayer('trigger', 'highlight'); Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ @@ -602,7 +591,6 @@ stepFarGrab.prototype = { cleanup: function() { debug("FarGrab | Cleanup"); this.finished = true; - setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); setControllerPartLayer('trigger', 'normal'); hideEntitiesWithTag(this.tag, { visible: false}); @@ -662,7 +650,6 @@ var stepEquip = function(name) { } stepEquip.prototype = { start: function(onFinish) { - setControllerVisible("trigger", true); setControllerPartLayer('tips', 'trigger'); setControllerPartLayer('trigger', 'highlight'); Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ @@ -764,7 +751,6 @@ stepEquip.prototype = { this.watcherIntervalID = null; } - setControllerVisible("trigger", false); setControllerPartLayer('tips', 'blank'); setControllerPartLayer('trigger', 'normal'); this.stopWatchingGun(); @@ -798,9 +784,6 @@ var stepTurnAround = function(name) { } stepTurnAround.prototype = { start: function(onFinish) { - setControllerVisible("left", true); - setControllerVisible("right", true); - setControllerPartLayer('touchpad', 'arrows'); setControllerPartLayer('tips', 'arrows'); @@ -840,9 +823,6 @@ stepTurnAround.prototype = { } catch (e) { } - setControllerVisible("left", false); - setControllerVisible("right", false); - setControllerPartLayer('touchpad', 'blank'); setControllerPartLayer('tips', 'blank'); From acb44d021cbbf9e9a5d15985c9b201889860b84b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 19 Oct 2016 10:45:51 -0700 Subject: [PATCH 11/22] Add HUD hiding to tutorial --- tutorial/tutorialZone.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index 42565aa99b..1538ebba95 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -72,6 +72,7 @@ if (!Function.prototype.bind) { setAwayEnabled(false); Menu.setIsOptionChecked("Overlays", false); MyAvatar.shouldRenderLocally = false; + Toolbars.getToolbar("com.highfidelity.interface.toolbar.system").writeProperty("visible", false); this.token = new OwnershipToken(Math.random() * 100000, this.entityID, { onGainedOwnership: function(token) { print("TutorialZone | GOT OWNERSHIP"); @@ -108,6 +109,7 @@ if (!Function.prototype.bind) { Menu.setIsOptionChecked("Overlays", true); MyAvatar.shouldRenderLocally = true; setAwayEnabled(true); + Toolbars.getToolbar("com.highfidelity.interface.toolbar.system").writeProperty("visible", true); } }, @@ -121,6 +123,10 @@ if (!Function.prototype.bind) { this.token.destroy(); this.token = null; } + if (self.tutorialManager) { + self.tutorialManager.stopTutorial(); + self.tutorialManager = null; + } } }; From 9207e882b19efe2fb84c4d3969601bab679997d6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 19 Oct 2016 15:48:17 -0700 Subject: [PATCH 12/22] Update butane lighter equip position in tutorial --- tutorial/lighter/createButaneLighter.js | 58 ++++++++++++++----------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/tutorial/lighter/createButaneLighter.js b/tutorial/lighter/createButaneLighter.js index caf3188b14..1a6b94d0f6 100644 --- a/tutorial/lighter/createButaneLighter.js +++ b/tutorial/lighter/createButaneLighter.js @@ -53,33 +53,39 @@ createButaneLighter = function(transform) { shapeType: 'simple-compound', type: 'Model', userData: JSON.stringify({ - tag: "equip-temporary", - grabbableKey: { - invertSolidWhileHeld: true + "tag": "equip-temporary", + "grabbableKey": { + "invertSolidWhileHeld": true }, - wearable: { - joints: { - RightHand: [{ - x: 0.029085848480463028, - y: 0.09807153046131134, - z: 0.03062543272972107 - }, { - x: 0.5929139256477356, - y: 0.3207578659057617, - z: 0.7151655554771423, - w: -0.18468326330184937 - }], - LeftHand: [{ - x: -0.029085848480463028, - y: 0.09807153046131134, - z: 0.03062543272972107 - }, { - x: -0.5929139256477356, - y: 0.3207578659057617, - z: 0.7151655554771423, - w: -0.18468326330184937 - }] - } + "wearable": { + "joints": { + "RightHand": [ + { + "x": 0.049671292304992676, + "y": 0.09825992584228516, + "z": 0.03760027885437012 + }, + { + "x": 0.6562752723693848, + "y": 0.27598991990089417, + "z": 0.6638742685317993, + "w": -0.22890058159828186 + } + ], + "LeftHand": [ + { + "x": -0.028073370456695557, + "y": 0.09609812498092651, + "z": 0.039550721645355225 + }, + { + "x": -0.6697965264320374, + "y": 0.22050897777080536, + "z": 0.6544681191444397, + "w": 0.27283111214637756 + } + ] + } } }), script: SCRIPT_URL From 639911e11f4d1b419802aea8fd50578da4c142d4 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 20 Oct 2016 16:29:25 -0700 Subject: [PATCH 13/22] Add extra logging to ownershipToken --- tutorial/ownershipToken.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tutorial/ownershipToken.js b/tutorial/ownershipToken.js index b76f3af1c2..4a970af66d 100644 --- a/tutorial/ownershipToken.js +++ b/tutorial/ownershipToken.js @@ -81,7 +81,6 @@ var TOKEN_STATE_OWNED = 2; OwnershipToken = function(name, parentEntityID, options) { this.name = MyAvatar.sessionUUID + "-" + Math.floor(Math.random() * 10000000); - this.name = Math.floor(Math.random() * 10000000); this.parentEntityID = parentEntityID; // How often to check whether the token is available if we don't currently own it @@ -160,7 +159,7 @@ OwnershipToken.prototype = { var ownerID = getOwnershipTokenID(this.parentEntityID); if (ownerID !== null) { // Already owned, return - debug(this.name, "Token already owned by another client, return"); + debug(this.name, "Token already owned by another client, returning. Owner: " + owenerID + ", Us: " + this.name); return; } From d577493d5efdcafd58a886988513865a8f8c16c6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 20 Oct 2016 16:39:35 -0700 Subject: [PATCH 14/22] Remove unneeded comments in tutorial scripts --- tutorial/entityData.js | 1 - tutorial/fuse.js | 1 - tutorial/fuseCollider.js | 1 - tutorial/tutorial.js | 9 --------- 4 files changed, 12 deletions(-) diff --git a/tutorial/entityData.js b/tutorial/entityData.js index 407e6e6b00..b14185e78f 100644 --- a/tutorial/entityData.js +++ b/tutorial/entityData.js @@ -60,7 +60,6 @@ birdFirework2 = { "z": 0 }, "id": "{ba067084-8d0f-4eeb-a8a1-c6814527c1bb}", - //"modelURL": "atp:/tutorial_models/statuebird4.fbx", "modelURL": "atp:/tutorial_models/bomb2.fbx", "owningAvatarID": "{00000000-0000-0000-0000-000000000000}", "position": { diff --git a/tutorial/fuse.js b/tutorial/fuse.js index 73a3a697bd..59306f4113 100644 --- a/tutorial/fuse.js +++ b/tutorial/fuse.js @@ -84,7 +84,6 @@ var self = this; Script.setTimeout(function() { debug("Setting off fireworks"); - //var spinnerID = Utils.findEntity({ name: "tutorial/equip/spinner" }, 20); var spinnerID = "{dd13fcd5-616f-4749-ab28-2e1e8bc512e9}"; Entities.callEntityMethod(spinnerID, "onLit"); injector.stop(); diff --git a/tutorial/fuseCollider.js b/tutorial/fuseCollider.js index 147444ac1d..953fcd316d 100644 --- a/tutorial/fuseCollider.js +++ b/tutorial/fuseCollider.js @@ -6,7 +6,6 @@ Fuse.prototype = { onLit: function() { print("fuseCollider.js | Lit", this.entityID); - //var fuseID = Utils.findEntity({ name: "tutorial/equip/fuse" }, 20); var fuseID = "{c8944a13-9acb-4d77-b1ee-851845e98357}" Entities.callEntityMethod(fuseID, "light"); }, diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index ea8dd792de..361d345011 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -193,7 +193,6 @@ function deleteEntitiesWithTag(tag) { } } function editEntitiesWithTag(tag, propertiesOrFn) { - //var entityIDs = findEntitiesWithTag(tag); var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag]; debug("Editing tag: ", tag); @@ -665,12 +664,6 @@ stepEquip.prototype = { this.currentPart = this.PART1; function createLighter() { - //var boxSpawnID = findEntity({ name: GUN_SPAWN_NAME }, 10000); - //if (!boxSpawnID) { - //info("Error creating block, cannot find spawn"); - //return null; - //} - var transform = {}; var boxSpawnProps = getEntityWithName(GUN_SPAWN_NAME); @@ -855,8 +848,6 @@ stepTeleport.prototype = { Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none'); // Wait until touching teleport pad... - //var padID = findEntity({ name: TELEPORT_PAD_NAME }, 100); - //var padProps = Entities.getEntityProperties(padID, ["position", "dimensions"]); var padProps = getEntityWithName(TELEPORT_PAD_NAME); var xMin = padProps.position.x - padProps.dimensions.x / 2; var xMax = padProps.position.x + padProps.dimensions.x / 2; From 8a7f67c8497780c6309e142ae63e23ccaeb6fd62 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:01:11 -0700 Subject: [PATCH 15/22] Cleanup client controller display implementation in tutorial --- tutorial/tutorial.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 361d345011..7b258611c7 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -250,10 +250,10 @@ var stepDisableControllers = function(name) { } stepDisableControllers.prototype = { start: function(onFinish) { - HMD.requestShowHandControllers(); - disableEverything(); + HMD.requestShowHandControllers(); + onFinish(); }, cleanup: function() { @@ -276,8 +276,6 @@ function disableEverything() { hideEntitiesWithTag('finish'); - controllerDisplayManager = new ControllerDisplayManager(); - setAwayEnabled(false); } @@ -295,7 +293,6 @@ function reenableEverything() { setControllerPartLayer('touchpad', 'blank'); setControllerPartLayer('tips', 'blank'); MyAvatar.shouldRenderLocally = true; - HMD.requestHideHandControllers(); setAwayEnabled(true); } @@ -313,6 +310,7 @@ var stepEnableControllers = function(name) { stepEnableControllers.prototype = { start: function(onFinish) { reenableEverything(); + HMD.requestHideHandControllers(); onFinish(); }, cleanup: function() { @@ -1099,6 +1097,7 @@ TutorialManager = function() { this.stopTutorial = function() { if (currentStep) { currentStep.cleanup(); + HMD.requestHideHandControllers(); } reenableEverything(); currentStepNum = -1; From 7b881a6be07e2275d37da74ad2809def4c46addf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:02:21 -0700 Subject: [PATCH 16/22] Add begin step to tutorial --- tutorial/tutorial.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 7b258611c7..1045599262 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -244,11 +244,10 @@ function playFirecrackerSound(position) { // STEP: DISABLE CONTROLLERS // // // /////////////////////////////////////////////////////////////////////////////// -var stepDisableControllers = function(name) { +var stepStart = function(name) { this.tag = name; - this.shouldLog = false; } -stepDisableControllers.prototype = { +stepStart.prototype = { start: function(onFinish) { disableEverything(); @@ -1035,7 +1034,7 @@ TutorialManager = function() { currentStep = null; startedTutorialAt = Date.now(); STEPS = [ - new stepDisableControllers("step0"), + new stepStart("start"), new stepOrient("orient"), //new stepRaiseAboveHead("raiseHands"), new stepNearGrab("nearGrab"), From e6d2900becdc2eb7767441a79d3549a554b15fe2 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:02:35 -0700 Subject: [PATCH 17/22] Loosen up the requirements for the turn step in the tutorial --- tutorial/tutorial.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 1045599262..0fb86d7247 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -784,8 +784,8 @@ stepTurnAround.prototype = { this.interval = Script.setInterval(function() { debug("TurnAround | Checking if finished", this.numTimesTurnPressed); - var FORWARD_THRESHOLD = 30; - var REQ_NUM_TIMES_PRESSED = 6; + var FORWARD_THRESHOLD = 90; + var REQ_NUM_TIMES_PRESSED = 3; var dir = Quat.getFront(MyAvatar.orientation); var angle = Math.atan2(dir.z, dir.x); From 7227e5770a229c2c1e1025e02962a52275fbba36 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:02:57 -0700 Subject: [PATCH 18/22] Fix bug in tutorialZone using self instead of this --- tutorial/tutorialZone.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index 1538ebba95..a40065e5d3 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -105,7 +105,7 @@ if (!Function.prototype.bind) { // If the start zone was exited, and the tutorial hasn't started, go ahead and // re-enable the HUD/Overlays - if (!self.tutorialManager) { + if (!this.tutorialManager) { Menu.setIsOptionChecked("Overlays", true); MyAvatar.shouldRenderLocally = true; setAwayEnabled(true); @@ -120,12 +120,13 @@ if (!Function.prototype.bind) { print("TutorialZone | EXITED THE TUTORIAL AREA"); if (this.token) { print("TutorialZone | Destroying token"); + //HMD.requestHideHandControllers(); this.token.destroy(); this.token = null; } - if (self.tutorialManager) { - self.tutorialManager.stopTutorial(); - self.tutorialManager = null; + if (this.tutorialManager) { + this.tutorialManager.stopTutorial(); + this.tutorialManager = null; } } }; From 47d7e89699f084e810eaff75df3840bca09276c8 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:03:15 -0700 Subject: [PATCH 19/22] Update portal to ensure that properties exist --- .../DomainContent/Home/portal.js | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/portal.js b/unpublishedScripts/DomainContent/Home/portal.js index 0ea090a6f7..ea6241265c 100644 --- a/unpublishedScripts/DomainContent/Home/portal.js +++ b/unpublishedScripts/DomainContent/Home/portal.js @@ -1,40 +1,47 @@ (function(){ var teleport; var portalDestination; + var thisEntityID; function playSound() { - Audio.playSound(teleport, { volume: 0.40, localOnly: true }); + var properties = Entities.getEntityProperties(thisEntityID, 'position'); + if (properties) { + Audio.playSound(teleport, { position: properties.position, volume: 0.40, localOnly: true }); + } }; this.preload = function(entityID) { + thisEntityID = entityID; teleport = SoundCache.getSound("atp:/sounds/teleport.raw"); - var properties = Entities.getEntityProperties(entityID); - portalDestination = properties.userData; - - print("portal.js | The portal destination is " + portalDestination); + var properties = Entities.getEntityProperties(entityID, 'userData'); + if (properties) { + portalDestination = properties.userData; + print("portal.js | The portal destination is " + portalDestination); + } } this.enterEntity = function(entityID) { print("portal.js | enterEntity"); - var properties = Entities.getEntityProperties(entityID); // in case the userData/portalURL has changed - portalDestination = properties.userData; + var properties = Entities.getEntityProperties(entityID, 'userData'); // in case the userData/portalURL has changed + if (properties) { + portalDestination = properties.userData; - print("portal.js | enterEntity() .... The portal destination is " + portalDestination); + print("portal.js | enterEntity() .... The portal destination is " + portalDestination); - if (portalDestination.length > 0) { - if (portalDestination[0] == '/') { - print("Teleporting to " + portalDestination); - Window.location = portalDestination; + if (portalDestination.length > 0) { + if (portalDestination[0] == '/') { + print("Teleporting to " + portalDestination); + Window.location = portalDestination; + } else { + print("Teleporting to hifi://" + portalDestination); + Window.location = "hifi://" + portalDestination; + } } else { - print("Teleporting to hifi://" + portalDestination); - Window.location = "hifi://" + portalDestination; + location.goToEntry(); // going forward: no data means go to appropriate entry point } - } else { - location.goToEntry(); // going forward: no data means go to appropriate entry point } - }; this.leaveEntity = function(entityID) { From 5eef9867b4a50201f793def079f590d9f12e06c3 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:04:00 -0700 Subject: [PATCH 20/22] Remove comment in tutorialZone --- tutorial/tutorialZone.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index a40065e5d3..40028c9cd7 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -120,7 +120,6 @@ if (!Function.prototype.bind) { print("TutorialZone | EXITED THE TUTORIAL AREA"); if (this.token) { print("TutorialZone | Destroying token"); - //HMD.requestHideHandControllers(); this.token.destroy(); this.token = null; } From 69e7dababc58634a00acc08fed8050f65a26797a Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 15:16:34 -0700 Subject: [PATCH 21/22] Collapse multiline dict to one line in controllerDisplay --- scripts/system/controllers/controllerDisplay.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/controllerDisplay.js b/scripts/system/controllers/controllerDisplay.js index 96ee955d19..6135f18426 100644 --- a/scripts/system/controllers/controllerDisplay.js +++ b/scripts/system/controllers/controllerDisplay.js @@ -43,10 +43,8 @@ function debug() { createControllerDisplay = function(config) { var controllerDisplay = { overlays: [], - partOverlays: { - }, - parts: { - }, + partOverlays: {}, + parts: {}, mappingName: "mapping-display-" + Math.random(), setVisible: function(visible) { From d933155c71f354b278c5e1fb8cc272aa200288fb Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 20:16:34 -0700 Subject: [PATCH 22/22] Fix trigger highlight configuration --- scripts/system/controllers/viveControllerConfiguration.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/viveControllerConfiguration.js b/scripts/system/controllers/viveControllerConfiguration.js index 11fc774376..b49c3e1d04 100644 --- a/scripts/system/controllers/viveControllerConfiguration.js +++ b/scripts/system/controllers/viveControllerConfiguration.js @@ -148,10 +148,10 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = { defaultTextureLayer: "normal", textureLayers: { normal: { - defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/black.jpg", + defaultTextureURL: BASE_URL + viveTriggerModelURL + "/Trigger.fbm/black.jpg", }, highlight: { - defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", + defaultTextureURL: BASE_URL + viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", } } }, @@ -280,10 +280,10 @@ VIVE_CONTROLLER_CONFIGURATION_RIGHT = { defaultTextureLayer: "normal", textureLayers: { normal: { - defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/black.jpg", + defaultTextureURL: BASE_URL + viveTriggerModelURL + "/Trigger.fbm/black.jpg", }, highlight: { - defaultTextureURL: viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", + defaultTextureURL: BASE_URL + viveTriggerModelURL + "/Trigger.fbm/yellow.jpg", } } },