Merge pull request #9247 from huffman/feat/tutorial-touch-grip

Add support for new Touch grip mappings to tutorial
This commit is contained in:
Brad Hefta-Gaub 2017-01-04 17:58:05 -08:00 committed by GitHub
commit 368f48f0a7
8 changed files with 84 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View file

@ -195,6 +195,8 @@ var STATE_OVERLAY_TOUCHING = 8;
var holdEnabled = true;
var nearGrabEnabled = true;
var farGrabEnabled = true;
var myAvatarScalingEnabled = true;
var objectScalingEnabled = true;
// "collidesWith" is specified by comma-separated list of group names
// the possible group names are: static, dynamic, kinematic, myAvatar, otherAvatar
@ -2312,6 +2314,10 @@ function MyController(hand) {
};
this.maybeScale = function(props) {
if (!objectScalingEnabled) {
return;
}
if (!this.shouldScale) {
// If both secondary triggers squeezed, and the non-holding hand is empty, start scaling
if (this.secondarySqueezed() && this.getOtherHandController().secondarySqueezed() && this.getOtherHandController().state === STATE_OFF) {
@ -2331,6 +2337,10 @@ function MyController(hand) {
}
this.maybeScaleMyAvatar = function() {
if (!myAvatarScalingEnabled) {
return;
}
if (!this.shouldScale) {
// If both secondary triggers squeezed, start scaling
if (this.secondarySqueezed() && this.getOtherHandController().secondarySqueezed()) {
@ -3016,6 +3026,14 @@ var handleHandMessages = function(channel, message, sender) {
print("farGrabEnabled: ", data.farGrabEnabled);
farGrabEnabled = data.farGrabEnabled;
}
if (data.myAvatarScalingEnabled !== undefined) {
print("myAvatarScalingEnabled: ", data.myAvatarScalingEnabled);
myAvatarScalingEnabled = data.myAvatarScalingEnabled;
}
if (data.objectScalingEnabled !== undefined) {
print("objectScalingEnabled: ", data.objectScalingEnabled);
objectScalingEnabled = data.objectScalingEnabled;
}
} else if (channel === 'Hifi-Hand-Grab') {
try {
data = JSON.parse(message);

View file

@ -74,6 +74,9 @@ TOUCH_CONTROLLER_CONFIGURATION_LEFT = {
teleport: {
defaultTextureURL: BASE_URL + "Oculus-Labels-L.fbx/Oculus-Labels-L.fbm/Teleport.png"
},
both_triggers: {
defaultTextureURL: BASE_URL + "Oculus-Labels-L.fbx/Oculus-Labels-L.fbm/Grip-Trigger.png"
},
}
},
@ -212,7 +215,7 @@ TOUCH_CONTROLLER_CONFIGURATION_RIGHT = {
modelURL: BASE_URL + "Oculus-Labels-R.fbx",
naturalPosition: { x: 0.009739525616168976, y: -0.0017818436026573181, z: 0.016794726252555847 },
textureName: "Texture",
textureName: "blank",
defaultTextureLayer: "blank",
textureLayers: {
blank: {
@ -230,6 +233,9 @@ TOUCH_CONTROLLER_CONFIGURATION_RIGHT = {
teleport: {
defaultTextureURL: BASE_URL + "Oculus-Labels-R.fbx/Oculus-Labels-R.fbm/Teleport.png"
},
both_triggers: {
defaultTextureURL: BASE_URL + "Oculus-Labels-R.fbx/Oculus-Labels-R.fbm/Grip-Trigger.png"
},
}
},

View file

@ -42,7 +42,7 @@ const appIcon = path.join(__dirname, '../resources/console.png');
const DELETE_LOG_FILES_OLDER_THAN_X_SECONDS = 60 * 60 * 24 * 7; // 7 Days
const LOG_FILE_REGEX = /(domain-server|ac-monitor|ac)-.*-std(out|err).txt/;
const HOME_CONTENT_URL = "http://cachefly.highfidelity.com/home-tutorial-release-5572.tar.gz";
const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-28.tar.gz";
function getBuildInfo() {
var buildInfoPath = null;

View file

@ -58,6 +58,9 @@ function info() {
}
}
const CONTROLLER_TOUCH = 'touch';
const CONTROLLER_VIVE = 'vive';
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";
@ -323,7 +326,7 @@ 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.
*/
@ -371,6 +374,8 @@ function disableEverything() {
nearGrabEnabled: true,
holdEnabled: false,
farGrabEnabled: false,
myAvatarScalingEnabled: false,
objectScalingEnabled: false,
}));
setControllerPartLayer('touchpad', 'blank');
setControllerPartLayer('trigger', 'blank');
@ -399,6 +404,8 @@ function reenableEverything() {
nearGrabEnabled: true,
holdEnabled: true,
farGrabEnabled: true,
myAvatarScalingEnabled: true,
objectScalingEnabled: true,
}));
setControllerPartLayer('touchpad', 'blank');
setControllerPartLayer('trigger', 'blank');
@ -516,12 +523,14 @@ stepOrient.prototype = {
// STEP: Near Grab //
// //
///////////////////////////////////////////////////////////////////////////////
var stepNearGrab = function() {
var stepNearGrab = function(tutorialManager) {
this.name = 'nearGrab';
this.tag = "nearGrab";
this.tags = ["bothGrab", "nearGrab", "nearGrab-" + tutorialManager.controllerName];
this.tempTag = "nearGrab-temporary";
this.birdIDs = [];
this.controllerName = tutorialManager.controllerName;
Messages.subscribe("Entity-Exploded");
Messages.messageReceived.connect(this.onMessage.bind(this));
}
@ -530,12 +539,17 @@ stepNearGrab.prototype = {
this.finished = false;
this.onFinish = onFinish;
setControllerPartLayer('tips', 'trigger');
setControllerPartLayer('trigger', 'highlight');
if (this.controllerName === CONTROLLER_TOUCH) {
setControllerPartLayer('tips', 'both_triggers');
setControllerPartLayer('trigger', 'highlight');
setControllerPartLayer('grip', 'highlight');
} else {
setControllerPartLayer('tips', 'trigger');
setControllerPartLayer('trigger', 'highlight');
}
// Spawn content set
showEntitiesWithTag(this.tag, { visible: true });
showEntitiesWithTag('bothGrab', { visible: true });
// Show content set
showEntitiesWithTags(this.tags);
var boxSpawnPosition = getEntityWithName(NEAR_BOX_SPAWN_NAME).position;
function createBlock(fireworkNumber) {
@ -573,8 +587,8 @@ stepNearGrab.prototype = {
this.finished = true;
setControllerPartLayer('tips', 'blank');
setControllerPartLayer('trigger', 'normal');
hideEntitiesWithTag(this.tag, { visible: false});
hideEntitiesWithTag('bothGrab', { visible: false});
setControllerPartLayer('grip', 'normal');
hideEntitiesWithTags(this.tags);
deleteEntitiesWithTag(this.tempTag);
if (this.positionWatcher) {
this.positionWatcher.destroy();
@ -696,6 +710,7 @@ PositionWatcher.prototype = {
///////////////////////////////////////////////////////////////////////////////
var stepEquip = function(tutorialManager) {
const controllerName = tutorialManager.controllerName;
this.controllerName = controllerName;
this.name = 'equip';
@ -714,8 +729,13 @@ var stepEquip = function(tutorialManager) {
}
stepEquip.prototype = {
start: function(onFinish) {
setControllerPartLayer('tips', 'trigger');
setControllerPartLayer('trigger', 'highlight');
if (this.controllerName === CONTROLLER_TOUCH) {
setControllerPartLayer('tips', 'grip');
setControllerPartLayer('grip', 'highlight');
} else {
setControllerPartLayer('tips', 'trigger');
setControllerPartLayer('trigger', 'highlight');
}
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
holdEnabled: true,

View file

@ -52,6 +52,16 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = {
"tag": "farGrab"
}
},
"nearGrab-vive": {
"{88221a22-b710-4d35-852b-5257b0aa77dc}": {
"tag": "nearGrab-vive"
}
},
"nearGrab-touch": {
"{7c0f2fde-6c5c-459b-bf82-421979cebf2e}": {
"tag": "nearGrab-touch"
}
},
"nearGrab": {
"{55c861ef-60ca-4722-a6c5-9c6967966ec5}": {
"tag": "nearGrab"
@ -59,9 +69,6 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = {
"{644d655b-ae66-43b1-9bab-a44b9a8ad632}": {
"tag": "nearGrab"
},
"{88221a22-b710-4d35-852b-5257b0aa77dc}": {
"tag": "nearGrab"
},
"{8bf0baa1-88d0-448a-a782-100d4413bd82}": {
"tag": "nearGrab"
},
@ -70,13 +77,20 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = {
"tag": "nearGrab"
}
},
"equip-part1-touch": {
"{470f0634-8be7-4b52-a8bd-5183d489fcb6}": {
"tag": "equip-part1-touch"
}
},
"equip-part1-vive": {
"{97ced5e7-fc81-40f9-a9e8-f85b4b30f24c}": {
"tag": "equip-part1-vive"
}
},
"equip-part1": {
"{d73822ca-0a34-4cf4-a530-3258ac459a14}": {
"tag": "equip-part1"
},
"{97ced5e7-fc81-40f9-a9e8-f85b4b30f24c}": {
"tag": "equip-part1"
},
"{8572d991-5777-45df-97bf-7243d7b12f81}": {
"tag": "equip-part1"
},
@ -102,16 +116,17 @@ TUTORIAL_TAG_TO_ENTITY_IDS_MAP = {
"equip-part2-vive": {
"{b5d17eda-90ab-40cf-b973-efcecb2e992e}": {
"tag": "equip-part2-vive"
},
"{6307cd16-dd1d-4988-a339-578178436b45}": {
"tag": "equip-part2-vive"
}
},
"equip-part2-touch": {
"{69195139-e020-4739-bb2c-50faebc6860a}": {
"tag": "equip-part2-touch"
}
},
"equip-part2": {
"{6307cd16-dd1d-4988-a339-578178436b45}": {
"tag": "equip-part2"
},
"{9b0a99ae-221b-4e59-ba3c-d8e64a083774}": {
"tag": "equip-part2-touch"
}
},
"bothGrab": {