Update controllers to include tips

This commit is contained in:
Ryan Huffman 2016-09-15 17:32:25 -07:00
parent 7f91491f04
commit 55586ccedb
2 changed files with 72 additions and 16 deletions

View file

@ -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);

View file

@ -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",
},