From 55586ccedbef7591bc060b64983a57c67d096d68 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 15 Sep 2016 17:32:25 -0700 Subject: [PATCH] Update controllers to include tips --- tutorial/controllerDisplay.js | 22 +++++---- tutorial/viveControllerConfiguration.js | 66 ++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/tutorial/controllerDisplay.js b/tutorial/controllerDisplay.js index ecce58e605..85dd50ce26 100644 --- a/tutorial/controllerDisplay.js +++ b/tutorial/controllerDisplay.js @@ -1,6 +1,7 @@ var DEBUG = false; var VISIBLE_BY_DEFAULT = false; -var PARENT_ID = MyAvatar.sessionUUID; +//var PARENT_ID = MyAvatar.sessionUUID; +var PARENT_ID = "{00000000-0000-0000-0000-000000000001}"; createControllerDisplay = function(config) { var controllerDisplay = { @@ -166,7 +167,7 @@ createControllerDisplay = function(config) { controllerDisplay.parts[partName] = controller.parts[partName]; - var overlayID = Overlays.addOverlay("model", { + var properties = { url: part.modelURL, localPosition: partPosition, localRotation: innerRotation, @@ -174,7 +175,15 @@ createControllerDisplay = function(config) { parentJointIndex: controller.jointIndex, ignoreRayIntersection: true, //visible: false - }); + }; + + if (part.defaultTextureLayer) { + var textures = {}; + textures[part.textureName] = part.textureLayers[part.defaultTextureLayer].defaultTextureURL; + properties['textures'] = textures; + } + + var overlayID = Overlays.addOverlay("model", properties); if (part.type == "rotational") { var range = part.maxValue - part.minValue; @@ -234,13 +243,6 @@ createControllerDisplay = function(config) { mapping.from([yinput]).peek().invert().to(function(value) { //print("Y", value); }); - if (part.defaultTextureURL) { - var textures = {}; - textures[part.textureName] = part.defaultTextureURL; - Overlays.editOverlay(overlayID, { - textures: textures - }); - } } else if (part.type == "static") { } else { print("TYPE NOT SUPPORTED: ", part.type); diff --git a/tutorial/viveControllerConfiguration.js b/tutorial/viveControllerConfiguration.js index d2f9403d8a..be0bfe5428 100644 --- a/tutorial/viveControllerConfiguration.js +++ b/tutorial/viveControllerConfiguration.js @@ -43,6 +43,7 @@ var viveNaturalPosition = { }; var viveModelURL = "https://hifi-public.s3.amazonaws.com/huffman/controllers/vive_body.fbx"; +var viveTipsModelURL = "https://hifi-content.s3.amazonaws.com/DomainContent/Tutorial/Models/vive_tips.fbx" VIVE_CONTROLLER_CONFIGURATION = { name: "Vive", @@ -57,6 +58,33 @@ VIVE_CONTROLLER_CONFIGURATION = { dimensions: viveNaturalDimensions, parts: { + tips: { + type: "static", + modelURL: viveTipsModelURL, + naturalPosition: {"x":-0.004377640783786774,"y":-0.034371938556432724,"z":0.06769277155399323}, + + textureName: "Tex.Blank", + + defaultTextureLayer: "trigger", + textureLayers: { + blank: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Blank.png", + }, + trigger: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Trigger.png", + }, + arrows: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Rotate.png", + }, + grip: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Grip.png", + }, + teleport: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Teleport.png", + }, + } + }, + // The touchpad type draws a dot indicating the current touch/thumb position // and swaps in textures based on the thumb position. touchpad: { @@ -70,10 +98,10 @@ VIVE_CONTROLLER_CONFIGURATION = { maxValue: 1.0, minPosition: { x: -0.035, y: 0.004, z: -0.005 }, maxPosition: { x: -0.035, y: 0.004, z: -0.005 }, - textureName: "Tex.touchpad-blank", + disable_textureName: "Tex.touchpad-blank", - defaultTextureLayer: "blank", - textureLayers: { + disable_defaultTextureLayer: "blank", + disable_textureLayers: { blank: { defaultTextureURL: "https://hifi-public.s3.amazonaws.com/huffman/controllers/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg", }, @@ -211,6 +239,32 @@ VIVE_CONTROLLER_CONFIGURATION = { }, parts: { + tips: { + type: "static", + modelURL: viveTipsModelURL, + naturalPosition: {"x":-0.004377640783786774,"y":-0.034371938556432724,"z":0.06769277155399323}, + + textureName: "Tex.Blank", + + defaultTextureLayer: "trigger", + textureLayers: { + blank: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Blank.png", + }, + trigger: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Trigger.png", + }, + arrows: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Rotate.png", + }, + grip: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Grip.png", + }, + teleport: { + defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Teleport.png", + }, + } + }, // The touchpad type draws a dot indicating the current touch/thumb position // and swaps in textures based on the thumb position. @@ -225,10 +279,10 @@ VIVE_CONTROLLER_CONFIGURATION = { maxValue: 1.0, minPosition: { x: -0.035, y: 0.004, z: -0.005 }, maxPosition: { x: -0.035, y: 0.004, z: -0.005 }, - textureName: "Tex.touchpad-blank", + disable_textureName: "Tex.touchpad-blank", - defaultTextureLayer: "blank", - textureLayers: { + disable_defaultTextureLayer: "blank", + disable_textureLayers: { blank: { defaultTextureURL: "https://hifi-public.s3.amazonaws.com/huffman/controllers/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg", },