Merge pull request #8880 from hyperlogic/feature/controller-display
Show hand controllers in away.js
After Width: | Height: | Size: 788 KiB |
After Width: | Height: | Size: 558 KiB |
BIN
interface/resources/meshes/controller/vive_body.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_button.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_l_grip.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_r_grip.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_sys_button.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_tips.fbm/Blank.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
interface/resources/meshes/controller/vive_tips.fbm/Grip.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
interface/resources/meshes/controller/vive_tips.fbm/Rotate.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
interface/resources/meshes/controller/vive_tips.fbm/Teleport.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
interface/resources/meshes/controller/vive_tips.fbm/Trigger.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
interface/resources/meshes/controller/vive_tips.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_trackpad.fbx
Normal file
BIN
interface/resources/meshes/controller/vive_trigger.fbx
Normal file
|
@ -57,6 +57,20 @@ bool HMDScriptingInterface::isHandControllerAvailable() {
|
||||||
return PluginUtils::isHandControllerAvailable();
|
return PluginUtils::isHandControllerAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HMDScriptingInterface::requestShowHandControllers() {
|
||||||
|
_showHandControllersCount++;
|
||||||
|
emit shouldShowHandControllersChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HMDScriptingInterface::requestHideHandControllers() {
|
||||||
|
_showHandControllersCount--;
|
||||||
|
emit shouldShowHandControllersChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HMDScriptingInterface::shouldShowHandControllers() const {
|
||||||
|
return _showHandControllersCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine) {
|
QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine) {
|
||||||
glm::vec3 hudIntersection;
|
glm::vec3 hudIntersection;
|
||||||
auto instance = DependencyManager::get<HMDScriptingInterface>();
|
auto instance = DependencyManager::get<HMDScriptingInterface>();
|
||||||
|
|
|
@ -41,6 +41,10 @@ public:
|
||||||
Q_INVOKABLE bool isHMDAvailable();
|
Q_INVOKABLE bool isHMDAvailable();
|
||||||
Q_INVOKABLE bool isHandControllerAvailable();
|
Q_INVOKABLE bool isHandControllerAvailable();
|
||||||
|
|
||||||
|
Q_INVOKABLE void requestShowHandControllers();
|
||||||
|
Q_INVOKABLE void requestHideHandControllers();
|
||||||
|
Q_INVOKABLE bool shouldShowHandControllers() const;
|
||||||
|
|
||||||
Q_INVOKABLE bool setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) const;
|
Q_INVOKABLE bool setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) const;
|
||||||
|
|
||||||
Q_INVOKABLE void disableHandLasers(int hands) const;
|
Q_INVOKABLE void disableHandLasers(int hands) const;
|
||||||
|
@ -61,6 +65,9 @@ public:
|
||||||
// rotate the overlay UI sphere so that it is centered about the the current HMD position and orientation
|
// rotate the overlay UI sphere so that it is centered about the the current HMD position and orientation
|
||||||
Q_INVOKABLE void centerUI();
|
Q_INVOKABLE void centerUI();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
bool shouldShowHandControllersChanged();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HMDScriptingInterface();
|
HMDScriptingInterface();
|
||||||
static QScriptValue getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine);
|
static QScriptValue getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine);
|
||||||
|
@ -77,6 +84,7 @@ private:
|
||||||
|
|
||||||
bool getHUDLookAtPosition3D(glm::vec3& result) const;
|
bool getHUDLookAtPosition3D(glm::vec3& result) const;
|
||||||
glm::mat4 getWorldHMDMatrix() const;
|
glm::mat4 getWorldHMDMatrix() const;
|
||||||
|
std::atomic<int> _showHandControllersCount { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_HMDScriptingInterface_h
|
#endif // hifi_HMDScriptingInterface_h
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <EntityScriptingInterface.h>
|
#include <EntityScriptingInterface.h>
|
||||||
#include <MessagesClient.h>
|
#include <MessagesClient.h>
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <ResourceScriptingInterface.h>
|
#include <ResourceScriptingInterface.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
|
@ -1136,6 +1137,10 @@ QUrl ScriptEngine::resolvePath(const QString& include) const {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl ScriptEngine::resourcesPath() const {
|
||||||
|
return QUrl::fromLocalFile(PathUtils::resourcesPath());
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEngine::print(const QString& message) {
|
void ScriptEngine::print(const QString& message) {
|
||||||
emit printedMessage(message);
|
emit printedMessage(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
Q_INVOKABLE void clearTimeout(QObject* timer) { stopTimer(reinterpret_cast<QTimer*>(timer)); }
|
Q_INVOKABLE void clearTimeout(QObject* timer) { stopTimer(reinterpret_cast<QTimer*>(timer)); }
|
||||||
Q_INVOKABLE void print(const QString& message);
|
Q_INVOKABLE void print(const QString& message);
|
||||||
Q_INVOKABLE QUrl resolvePath(const QString& path) const;
|
Q_INVOKABLE QUrl resolvePath(const QString& path) const;
|
||||||
|
Q_INVOKABLE QUrl resourcesPath() const;
|
||||||
|
|
||||||
// Entity Script Related methods
|
// Entity Script Related methods
|
||||||
static void loadEntityScript(QWeakPointer<ScriptEngine> theEngine, const EntityItemID& entityID, const QString& entityScript, bool forceRedownload);
|
static void loadEntityScript(QWeakPointer<ScriptEngine> theEngine, const EntityItemID& entityID, const QString& entityScript, bool forceRedownload);
|
||||||
|
|
|
@ -23,6 +23,7 @@ var DEFAULT_SCRIPTS = [
|
||||||
"system/mod.js",
|
"system/mod.js",
|
||||||
"system/selectAudioDevice.js",
|
"system/selectAudioDevice.js",
|
||||||
"system/notifications.js",
|
"system/notifications.js",
|
||||||
|
"system/controllers/controllerDisplayManager.js",
|
||||||
"system/controllers/handControllerGrab.js",
|
"system/controllers/handControllerGrab.js",
|
||||||
"system/controllers/handControllerPointer.js",
|
"system/controllers/handControllerPointer.js",
|
||||||
"system/controllers/squeezeHands.js",
|
"system/controllers/squeezeHands.js",
|
||||||
|
@ -125,4 +126,4 @@ Script.scriptEnding.connect(function() {
|
||||||
removeMenuItem();
|
removeMenuItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
Menu.menuItemEvent.connect(menuItemEvent);
|
Menu.menuItemEvent.connect(menuItemEvent);
|
||||||
|
|
|
@ -177,6 +177,8 @@ function goAway(fromStartup) {
|
||||||
playAwayAnimation(); // animation is still seen by others
|
playAwayAnimation(); // animation is still seen by others
|
||||||
showOverlay();
|
showOverlay();
|
||||||
|
|
||||||
|
HMD.requestShowHandControllers();
|
||||||
|
|
||||||
// tell the Reticle, we want to stop capturing the mouse until we come back
|
// tell the Reticle, we want to stop capturing the mouse until we come back
|
||||||
Reticle.allowMouseCapture = false;
|
Reticle.allowMouseCapture = false;
|
||||||
// Allow users to find their way to other applications, our menus, etc.
|
// Allow users to find their way to other applications, our menus, etc.
|
||||||
|
@ -215,6 +217,8 @@ function goActive() {
|
||||||
MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting.
|
MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting.
|
||||||
stopAwayAnimation();
|
stopAwayAnimation();
|
||||||
|
|
||||||
|
HMD.requestHideHandControllers();
|
||||||
|
|
||||||
// update the UI sphere to be centered about the current HMD orientation.
|
// update the UI sphere to be centered about the current HMD orientation.
|
||||||
HMD.centerUI();
|
HMD.centerUI();
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,45 @@
|
||||||
var VISIBLE_BY_DEFAULT = false;
|
//
|
||||||
|
// controllerDisplay.js
|
||||||
|
//
|
||||||
|
// Created by Anthony J. Thibault on 10/20/16
|
||||||
|
// Originally created by Ryan Huffman on 9/21/2016
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
/* globals createControllerDisplay:true deleteControllerDisplay:true */
|
||||||
|
|
||||||
var PARENT_ID = "{00000000-0000-0000-0000-000000000001}";
|
var PARENT_ID = "{00000000-0000-0000-0000-000000000001}";
|
||||||
|
|
||||||
var DEBUG = false;
|
function clamp(value, min, max) {
|
||||||
function debug() {
|
if (value < min) {
|
||||||
if (DEBUG) {
|
return min;
|
||||||
print.apply(self, arguments);
|
} else if (value > max) {
|
||||||
|
return max;
|
||||||
}
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveHardware(path) {
|
||||||
|
var parts = path.split(".");
|
||||||
|
function resolveInner(base, path, i) {
|
||||||
|
if (i >= path.length) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
return resolveInner(base[path[i]], path, ++i);
|
||||||
|
}
|
||||||
|
return resolveInner(Controller.Hardware, parts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
createControllerDisplay = function(config) {
|
createControllerDisplay = function(config) {
|
||||||
var controllerDisplay = {
|
var controllerDisplay = {
|
||||||
overlays: [],
|
overlays: [],
|
||||||
partOverlays: {
|
partOverlays: {},
|
||||||
},
|
parts: {},
|
||||||
parts: {
|
|
||||||
},
|
|
||||||
mappingName: "mapping-display",
|
mappingName: "mapping-display",
|
||||||
|
|
||||||
setVisible: function(visible) {
|
setVisible: function(visible) {
|
||||||
print("CONTROLLER_DISPLAY::Setting visible", this.overlays.length);
|
|
||||||
for (var i = 0; i < this.overlays.length; ++i) {
|
for (var i = 0; i < this.overlays.length; ++i) {
|
||||||
print("i", i, this.overlays[i]);
|
|
||||||
Overlays.editOverlay(this.overlays[i], {
|
Overlays.editOverlay(this.overlays[i], {
|
||||||
visible: visible
|
visible: visible
|
||||||
});
|
});
|
||||||
|
@ -30,7 +49,6 @@ createControllerDisplay = function(config) {
|
||||||
setPartVisible: function(partName, visible) {
|
setPartVisible: function(partName, visible) {
|
||||||
return;
|
return;
|
||||||
if (partName in this.partOverlays) {
|
if (partName in this.partOverlays) {
|
||||||
debug("Setting part visible", partName, visible);
|
|
||||||
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
||||||
Overlays.editOverlay(this.partOverlays[partName][i], {
|
Overlays.editOverlay(this.partOverlays[partName][i], {
|
||||||
//visible: visible
|
//visible: visible
|
||||||
|
@ -41,7 +59,6 @@ createControllerDisplay = function(config) {
|
||||||
|
|
||||||
setLayerForPart: function(partName, layerName) {
|
setLayerForPart: function(partName, layerName) {
|
||||||
if (partName in this.parts) {
|
if (partName in this.parts) {
|
||||||
debug("Setting layer...", partName, layerName);
|
|
||||||
var part = this.parts[partName];
|
var part = this.parts[partName];
|
||||||
if (part.textureLayers && layerName in part.textureLayers) {
|
if (part.textureLayers && layerName in part.textureLayers) {
|
||||||
var layer = part.textureLayers[layerName];
|
var layer = part.textureLayers[layerName];
|
||||||
|
@ -50,6 +67,9 @@ createControllerDisplay = function(config) {
|
||||||
textures[part.textureName] = layer.defaultTextureURL;
|
textures[part.textureName] = layer.defaultTextureURL;
|
||||||
}
|
}
|
||||||
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
||||||
|
|
||||||
|
// AJT: REMOVE
|
||||||
|
print("AJT: Overlays.editOverlays(" + partName + ", " + i + ", { textures: " + JSON.stringify(textures) + " })");
|
||||||
Overlays.editOverlay(this.partOverlays[partName][i], {
|
Overlays.editOverlay(this.partOverlays[partName][i], {
|
||||||
textures: textures
|
textures: textures
|
||||||
});
|
});
|
||||||
|
@ -64,8 +84,7 @@ createControllerDisplay = function(config) {
|
||||||
var position = controller.position;
|
var position = controller.position;
|
||||||
|
|
||||||
if (controller.naturalPosition) {
|
if (controller.naturalPosition) {
|
||||||
position = Vec3.sum(Vec3.multiplyQbyV(
|
position = Vec3.sum(Vec3.multiplyQbyV(controller.rotation, controller.naturalPosition), position);
|
||||||
controller.rotation, controller.naturalPosition), position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var overlayID = Overlays.addOverlay("model", {
|
var overlayID = Overlays.addOverlay("model", {
|
||||||
|
@ -75,26 +94,17 @@ createControllerDisplay = function(config) {
|
||||||
localPosition: position,
|
localPosition: position,
|
||||||
parentID: PARENT_ID,
|
parentID: PARENT_ID,
|
||||||
parentJointIndex: controller.jointIndex,
|
parentJointIndex: controller.jointIndex,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true
|
||||||
});
|
});
|
||||||
|
|
||||||
controllerDisplay.overlays.push(overlayID);
|
controllerDisplay.overlays.push(overlayID);
|
||||||
overlayID = null;
|
overlayID = null;
|
||||||
|
|
||||||
function clamp(value, min, max) {
|
|
||||||
if (value < min) {
|
|
||||||
return min;
|
|
||||||
} else if (value > max) {
|
|
||||||
return max
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controller.parts) {
|
if (controller.parts) {
|
||||||
for (var partName in controller.parts) {
|
for (var partName in controller.parts) {
|
||||||
var part = controller.parts[partName];
|
var part = controller.parts[partName];
|
||||||
var partPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, part.naturalPosition));
|
var partPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, part.naturalPosition));
|
||||||
var innerRotation = controller.rotation
|
var innerRotation = controller.rotation;
|
||||||
|
|
||||||
controllerDisplay.parts[partName] = controller.parts[partName];
|
controllerDisplay.parts[partName] = controller.parts[partName];
|
||||||
|
|
||||||
|
@ -104,7 +114,7 @@ createControllerDisplay = function(config) {
|
||||||
localRotation: innerRotation,
|
localRotation: innerRotation,
|
||||||
parentID: PARENT_ID,
|
parentID: PARENT_ID,
|
||||||
parentJointIndex: controller.jointIndex,
|
parentJointIndex: controller.jointIndex,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (part.defaultTextureLayer) {
|
if (part.defaultTextureLayer) {
|
||||||
|
@ -113,10 +123,9 @@ createControllerDisplay = function(config) {
|
||||||
properties['textures'] = textures;
|
properties['textures'] = textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
var overlayID = Overlays.addOverlay("model", properties);
|
overlayID = Overlays.addOverlay("model", properties);
|
||||||
|
|
||||||
if (part.type == "rotational") {
|
if (part.type === "rotational") {
|
||||||
var range = part.maxValue - part.minValue;
|
|
||||||
mapping.from([part.input]).peek().to(function(controller, overlayID, part) {
|
mapping.from([part.input]).peek().to(function(controller, overlayID, part) {
|
||||||
return function(value) {
|
return function(value) {
|
||||||
value = clamp(value, part.minValue, part.maxValue);
|
value = clamp(value, part.minValue, part.maxValue);
|
||||||
|
@ -127,7 +136,7 @@ createControllerDisplay = function(config) {
|
||||||
|
|
||||||
var offset = { x: 0, y: 0, z: 0 };
|
var offset = { x: 0, y: 0, z: 0 };
|
||||||
if (part.origin) {
|
if (part.origin) {
|
||||||
var offset = Vec3.multiplyQbyV(rotation, part.origin);
|
offset = Vec3.multiplyQbyV(rotation, part.origin);
|
||||||
offset = Vec3.subtract(offset, part.origin);
|
offset = Vec3.subtract(offset, part.origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,20 +147,9 @@ createControllerDisplay = function(config) {
|
||||||
localPosition: partPosition,
|
localPosition: partPosition,
|
||||||
localRotation: Quat.multiply(controller.rotation, rotation)
|
localRotation: Quat.multiply(controller.rotation, rotation)
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}(controller, overlayID, part));
|
}(controller, overlayID, part));
|
||||||
} else if (part.type == "touchpad") {
|
} else if (part.type === "touchpad") {
|
||||||
function resolveHardware(path) {
|
|
||||||
var parts = path.split(".");
|
|
||||||
function resolveInner(base, path, i) {
|
|
||||||
if (i >= path.length) {
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
return resolveInner(base[path[i]], path, ++i);
|
|
||||||
}
|
|
||||||
return resolveInner(Controller.Hardware, parts, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var visibleInput = resolveHardware(part.visibleInput);
|
var visibleInput = resolveHardware(part.visibleInput);
|
||||||
var xinput = resolveHardware(part.xInput);
|
var xinput = resolveHardware(part.xInput);
|
||||||
var yinput = resolveHardware(part.yInput);
|
var yinput = resolveHardware(part.yInput);
|
||||||
|
@ -165,7 +163,8 @@ createControllerDisplay = function(config) {
|
||||||
});
|
});
|
||||||
mapping.from([yinput]).peek().invert().to(function(value) {
|
mapping.from([yinput]).peek().invert().to(function(value) {
|
||||||
});
|
});
|
||||||
} else if (part.type == "static") {
|
} else if (part.type === "static") {
|
||||||
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
print("TYPE NOT SUPPORTED: ", part.type);
|
print("TYPE NOT SUPPORTED: ", part.type);
|
||||||
}
|
}
|
||||||
|
@ -180,16 +179,11 @@ createControllerDisplay = function(config) {
|
||||||
}
|
}
|
||||||
Controller.enableMapping(controllerDisplay.mappingName);
|
Controller.enableMapping(controllerDisplay.mappingName);
|
||||||
return controllerDisplay;
|
return controllerDisplay;
|
||||||
}
|
|
||||||
|
|
||||||
ControllerDisplay = function() {
|
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteControllerDisplay = function(controllerDisplay) {
|
deleteControllerDisplay = function(controllerDisplay) {
|
||||||
print("Deleting controller display");
|
|
||||||
for (var i = 0; i < controllerDisplay.overlays.length; ++i) {
|
for (var i = 0; i < controllerDisplay.overlays.length; ++i) {
|
||||||
Overlays.deleteOverlay(controllerDisplay.overlays[i]);
|
Overlays.deleteOverlay(controllerDisplay.overlays[i]);
|
||||||
}
|
}
|
||||||
Controller.disableMapping(controllerDisplay.mappingName);
|
Controller.disableMapping(controllerDisplay.mappingName);
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,49 +1,24 @@
|
||||||
if (!Function.prototype.bind) {
|
//
|
||||||
Function.prototype.bind = function(oThis) {
|
// controllerDisplayManager.js
|
||||||
if (typeof this !== 'function') {
|
//
|
||||||
// closest thing possible to the ECMAScript 5
|
// Created by Anthony J. Thibault on 10/20/16
|
||||||
// internal IsCallable function
|
// Originally created by Ryan Huffman on 9/21/2016
|
||||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
//
|
||||||
}
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
/* globals ControllerDisplayManager:true createControllerDisplay deleteControllerDisplay
|
||||||
fToBind = this,
|
VIVE_CONTROLLER_CONFIGURATION_LEFT VIVE_CONTROLLER_CONFIGURATION_RIGHT */
|
||||||
fNOP = function() {},
|
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||||
fBound = function() {
|
|
||||||
return fToBind.apply(this instanceof fNOP
|
|
||||||
? this
|
|
||||||
: oThis,
|
|
||||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.prototype) {
|
(function () {
|
||||||
// Function.prototype doesn't have a prototype property
|
|
||||||
fNOP.prototype = this.prototype;
|
|
||||||
}
|
|
||||||
fBound.prototype = new fNOP();
|
|
||||||
|
|
||||||
return fBound;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Script.setTimeout(function() { print('timeout') }, 100);
|
|
||||||
|
|
||||||
Script.include("controllerDisplay.js");
|
Script.include("controllerDisplay.js");
|
||||||
Script.include("viveControllerConfiguration.js");
|
Script.include("viveControllerConfiguration.js");
|
||||||
|
|
||||||
function debug() {
|
//
|
||||||
var args = Array.prototype.slice.call(arguments);
|
// Management of controller display
|
||||||
args.unshift("CONTROLLER DEBUG:");
|
//
|
||||||
print.apply(this, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
var zeroPosition = { x: 0, y: 0, z: 0 };
|
|
||||||
var zeroRotation = { x: 0, y: 0, z: 0, w: 1 };
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Management of controller display //
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
ControllerDisplayManager = function() {
|
ControllerDisplayManager = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var controllerLeft = null;
|
var controllerLeft = null;
|
||||||
|
@ -51,30 +26,24 @@ ControllerDisplayManager = function() {
|
||||||
var controllerCheckerIntervalID = null;
|
var controllerCheckerIntervalID = null;
|
||||||
|
|
||||||
this.setLeftVisible = function(visible) {
|
this.setLeftVisible = function(visible) {
|
||||||
print("settings controller display to visible");
|
|
||||||
if (controllerLeft) {
|
if (controllerLeft) {
|
||||||
print("doign it...", visible);
|
|
||||||
controllerLeft.setVisible(visible);
|
controllerLeft.setVisible(visible);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setRightVisible = function(visible) {
|
this.setRightVisible = function(visible) {
|
||||||
print("settings controller display to visible");
|
|
||||||
if (controllerRight) {
|
if (controllerRight) {
|
||||||
print("doign it...", visible);
|
|
||||||
controllerRight.setVisible(visible);
|
controllerRight.setVisible(visible);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateControllers() {
|
function updateControllers() {
|
||||||
if (HMD.active) {
|
if (HMD.active && HMD.shouldShowHandControllers()) {
|
||||||
if ("Vive" in Controller.Hardware) {
|
if ("Vive" in Controller.Hardware) {
|
||||||
if (!controllerLeft) {
|
if (!controllerLeft) {
|
||||||
debug("Found vive left!");
|
|
||||||
controllerLeft = createControllerDisplay(VIVE_CONTROLLER_CONFIGURATION_LEFT);
|
controllerLeft = createControllerDisplay(VIVE_CONTROLLER_CONFIGURATION_LEFT);
|
||||||
}
|
}
|
||||||
if (!controllerRight) {
|
if (!controllerRight) {
|
||||||
debug("Found vive right!");
|
|
||||||
controllerRight = createControllerDisplay(VIVE_CONTROLLER_CONFIGURATION_RIGHT);
|
controllerRight = createControllerDisplay(VIVE_CONTROLLER_CONFIGURATION_RIGHT);
|
||||||
}
|
}
|
||||||
// We've found the controllers, we no longer need to look for active controllers
|
// We've found the controllers, we no longer need to look for active controllers
|
||||||
|
@ -83,17 +52,14 @@ ControllerDisplayManager = function() {
|
||||||
controllerCheckerIntervalID = null;
|
controllerCheckerIntervalID = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug("HMD active, but no controllers found");
|
|
||||||
self.deleteControllerDisplays();
|
self.deleteControllerDisplays();
|
||||||
if (controllerCheckerIntervalID == null) {
|
if (!controllerCheckerIntervalID) {
|
||||||
controllerCheckerIntervalID = Script.setInterval(updateControllers, 1000);
|
controllerCheckerIntervalID = Script.setInterval(updateControllers, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug("HMD inactive");
|
|
||||||
// We aren't in HMD mode, we no longer need to look for active controllers
|
// We aren't in HMD mode, we no longer need to look for active controllers
|
||||||
if (controllerCheckerIntervalID) {
|
if (controllerCheckerIntervalID) {
|
||||||
debug("Clearing controller checker interval");
|
|
||||||
Script.clearInterval(controllerCheckerIntervalID);
|
Script.clearInterval(controllerCheckerIntervalID);
|
||||||
controllerCheckerIntervalID = null;
|
controllerCheckerIntervalID = null;
|
||||||
}
|
}
|
||||||
|
@ -103,39 +69,34 @@ ControllerDisplayManager = function() {
|
||||||
|
|
||||||
Messages.subscribe('Controller-Display');
|
Messages.subscribe('Controller-Display');
|
||||||
var handleMessages = function(channel, message, sender) {
|
var handleMessages = function(channel, message, sender) {
|
||||||
|
var i, data, name, visible;
|
||||||
if (!controllerLeft && !controllerRight) {
|
if (!controllerLeft && !controllerRight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender === MyAvatar.sessionUUID) {
|
if (sender === MyAvatar.sessionUUID) {
|
||||||
if (channel === 'Controller-Display') {
|
if (channel === 'Controller-Display') {
|
||||||
var data = JSON.parse(message);
|
data = JSON.parse(message);
|
||||||
var name = data.name;
|
name = data.name;
|
||||||
var visible = data.visible;
|
visible = data.visible;
|
||||||
//c.setDisplayAnnotation(name, visible);
|
|
||||||
if (controllerLeft) {
|
if (controllerLeft) {
|
||||||
if (name in controllerLeft.annotations) {
|
if (name in controllerLeft.annotations) {
|
||||||
debug("hiding");
|
for (i = 0; i < controllerLeft.annotations[name].length; ++i) {
|
||||||
for (var i = 0; i < controllerLeft.annotations[name].length; ++i) {
|
|
||||||
debug("hiding", i);
|
|
||||||
Overlays.editOverlay(controllerLeft.annotations[name][i], { visible: visible });
|
Overlays.editOverlay(controllerLeft.annotations[name][i], { visible: visible });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (controllerRight) {
|
if (controllerRight) {
|
||||||
if (name in controllerRight.annotations) {
|
if (name in controllerRight.annotations) {
|
||||||
debug("hiding");
|
for (i = 0; i < controllerRight.annotations[name].length; ++i) {
|
||||||
for (var i = 0; i < controllerRight.annotations[name].length; ++i) {
|
|
||||||
debug("hiding", i);
|
|
||||||
Overlays.editOverlay(controllerRight.annotations[name][i], { visible: visible });
|
Overlays.editOverlay(controllerRight.annotations[name][i], { visible: visible });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (channel === 'Controller-Display-Parts') {
|
} else if (channel === 'Controller-Display-Parts') {
|
||||||
debug('here part');
|
data = JSON.parse(message);
|
||||||
var data = JSON.parse(message);
|
for (name in data) {
|
||||||
for (var name in data) {
|
visible = data[name];
|
||||||
var visible = data[name];
|
|
||||||
if (controllerLeft) {
|
if (controllerLeft) {
|
||||||
controllerLeft.setPartVisible(name, visible);
|
controllerLeft.setPartVisible(name, visible);
|
||||||
}
|
}
|
||||||
|
@ -144,8 +105,8 @@ ControllerDisplayManager = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (channel === 'Controller-Set-Part-Layer') {
|
} else if (channel === 'Controller-Set-Part-Layer') {
|
||||||
var data = JSON.parse(message);
|
data = JSON.parse(message);
|
||||||
for (var name in data) {
|
for (name in data) {
|
||||||
var layer = data[name];
|
var layer = data[name];
|
||||||
if (controllerLeft) {
|
if (controllerLeft) {
|
||||||
controllerLeft.setLayerForPart(name, layer);
|
controllerLeft.setLayerForPart(name, layer);
|
||||||
|
@ -154,20 +115,17 @@ ControllerDisplayManager = function() {
|
||||||
controllerRight.setLayerForPart(name, layer);
|
controllerRight.setLayerForPart(name, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (channel == 'Hifi-Object-Manipulation') {// && sender == MyAvatar.sessionUUID) {
|
} else if (channel === 'Hifi-Object-Manipulation') {
|
||||||
//print("got manip");
|
data = JSON.parse(message);
|
||||||
var data = JSON.parse(message);
|
visible = data.action !== 'equip';
|
||||||
//print("post data", data);
|
if (data.joint === "LeftHand") {
|
||||||
var visible = data.action != 'equip';
|
|
||||||
//print("Calling...");
|
|
||||||
if (data.joint == "LeftHand") {
|
|
||||||
self.setLeftVisible(visible);
|
self.setLeftVisible(visible);
|
||||||
} else if (data.joint == "RightHand") {
|
} else if (data.joint === "RightHand") {
|
||||||
self.setRightVisible(visible);
|
self.setRightVisible(visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
Messages.messageReceived.connect(handleMessages);
|
Messages.messageReceived.connect(handleMessages);
|
||||||
|
|
||||||
|
@ -183,12 +141,24 @@ ControllerDisplayManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.destroy = function() {
|
this.destroy = function() {
|
||||||
print("Destroying controller display");
|
|
||||||
Messages.messageReceived.disconnect(handleMessages);
|
Messages.messageReceived.disconnect(handleMessages);
|
||||||
|
|
||||||
|
HMD.displayModeChanged.disconnect(updateControllers);
|
||||||
|
HMD.shouldShowHandControllersChanged.disconnect(updateControllers);
|
||||||
|
|
||||||
self.deleteControllerDisplays();
|
self.deleteControllerDisplays();
|
||||||
};
|
};
|
||||||
|
|
||||||
HMD.displayModeChanged.connect(updateControllers);
|
HMD.displayModeChanged.connect(updateControllers);
|
||||||
|
HMD.shouldShowHandControllersChanged.connect(updateControllers);
|
||||||
|
|
||||||
updateControllers();
|
updateControllers();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
var controllerDisplayManager = new ControllerDisplayManager();
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function () {
|
||||||
|
controllerDisplayManager.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
}());
|
|
@ -11,7 +11,10 @@
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
/* global setEntityCustomData, getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings, Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset, setGrabCommunications */
|
|
||||||
|
/* global setEntityCustomData, getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
|
||||||
|
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset, setGrabCommunications */
|
||||||
|
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
//
|
||||||
|
// viveControllerConfiguration.js
|
||||||
|
//
|
||||||
|
// Created by Anthony J. Thibault on 10/20/16
|
||||||
|
// Originally created by Ryan Huffman on 9/21/2016
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
/* globals VIVE_CONTROLLER_CONFIGURATION_LEFT:true VIVE_CONTROLLER_CONFIGURATION_RIGHT:true */
|
||||||
|
/* eslint camelcase: ["error", { "properties": "never" }] */
|
||||||
|
|
||||||
var LEFT_JOINT_INDEX = MyAvatar.getJointIndex("_CONTROLLER_LEFTHAND");
|
var LEFT_JOINT_INDEX = MyAvatar.getJointIndex("_CONTROLLER_LEFTHAND");
|
||||||
var RIGHT_JOINT_INDEX = MyAvatar.getJointIndex("_CONTROLLER_RIGHTHAND");
|
var RIGHT_JOINT_INDEX = MyAvatar.getJointIndex("_CONTROLLER_RIGHTHAND");
|
||||||
|
|
||||||
|
@ -44,8 +57,11 @@ var viveNaturalPosition = {
|
||||||
z: 0.06380049744620919
|
z: 0.06380049744620919
|
||||||
};
|
};
|
||||||
|
|
||||||
var viveModelURL = "atp:/controller/vive_body.fbx";
|
var BASE_URL = Script.resourcesPath();
|
||||||
var viveTipsModelURL = "atp:/controller/vive_tips.fbx"
|
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";
|
||||||
|
|
||||||
VIVE_CONTROLLER_CONFIGURATION_LEFT = {
|
VIVE_CONTROLLER_CONFIGURATION_LEFT = {
|
||||||
name: "Vive",
|
name: "Vive",
|
||||||
|
@ -70,20 +86,20 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = {
|
||||||
defaultTextureLayer: "blank",
|
defaultTextureLayer: "blank",
|
||||||
textureLayers: {
|
textureLayers: {
|
||||||
blank: {
|
blank: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Blank.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "Blank.png"
|
||||||
},
|
},
|
||||||
trigger: {
|
trigger: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Trigger.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Trigger.png"
|
||||||
},
|
},
|
||||||
arrows: {
|
arrows: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Rotate.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Rotate.png"
|
||||||
},
|
},
|
||||||
grip: {
|
grip: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Grip.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Grip.png"
|
||||||
},
|
},
|
||||||
teleport: {
|
teleport: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Teleport.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Teleport.png"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -91,7 +107,7 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = {
|
||||||
// and swaps in textures based on the thumb position.
|
// and swaps in textures based on the thumb position.
|
||||||
touchpad: {
|
touchpad: {
|
||||||
type: "touchpad",
|
type: "touchpad",
|
||||||
modelURL: "atp:/controller/vive_trackpad.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_trackpad.fbx",
|
||||||
visibleInput: "Vive.RSTouch",
|
visibleInput: "Vive.RSTouch",
|
||||||
xInput: "Vive.LX",
|
xInput: "Vive.LX",
|
||||||
yInput: "Vive.LY",
|
yInput: "Vive.LY",
|
||||||
|
@ -105,64 +121,63 @@ VIVE_CONTROLLER_CONFIGURATION_LEFT = {
|
||||||
disable_defaultTextureLayer: "blank",
|
disable_defaultTextureLayer: "blank",
|
||||||
disable_textureLayers: {
|
disable_textureLayers: {
|
||||||
blank: {
|
blank: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg"
|
||||||
},
|
},
|
||||||
teleport: {
|
teleport: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-teleport-active-LG.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-teleport-active-LG.jpg"
|
||||||
},
|
},
|
||||||
arrows: {
|
arrows: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-look-arrows.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-look-arrows.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger: {
|
trigger: {
|
||||||
type: "rotational",
|
type: "rotational",
|
||||||
modelURL: "atp:/controller/vive_trigger.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_trigger.fbx",
|
||||||
input: Controller.Standard.LT,
|
input: Controller.Standard.LT,
|
||||||
naturalPosition: {"x":0.000004500150680541992,"y":-0.027690507471561432,"z":0.04830199480056763},
|
naturalPosition: {"x":0.000004500150680541992,"y":-0.027690507471561432,"z":0.04830199480056763},
|
||||||
origin: { x: 0, y: -0.015, z: -0.00 },
|
origin: { x: 0, y: -0.015, z: -0.00 },
|
||||||
minValue: 0.0,
|
minValue: 0.0,
|
||||||
maxValue: 1.0,
|
maxValue: 1.0,
|
||||||
axis: { x: -1, y: 0, z: 0 },
|
axis: { x: -1, y: 0, z: 0 },
|
||||||
maxAngle: 20,
|
maxAngle: 20
|
||||||
},
|
},
|
||||||
|
|
||||||
l_grip: {
|
l_grip: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_l_grip.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_l_grip.fbx",
|
||||||
naturalPosition: {"x":-0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226},
|
naturalPosition: {"x":-0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226}
|
||||||
},
|
},
|
||||||
|
|
||||||
r_grip: {
|
r_grip: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_r_grip.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_r_grip.fbx",
|
||||||
naturalPosition: {"x":0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226},
|
naturalPosition: {"x":0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226}
|
||||||
},
|
},
|
||||||
|
|
||||||
sys_button: {
|
sys_button: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_sys_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_sys_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.0020399854984134436,"z":0.08825899660587311},
|
naturalPosition: {"x":0,"y":0.0020399854984134436,"z":0.08825899660587311}
|
||||||
},
|
},
|
||||||
|
|
||||||
button: {
|
button: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
||||||
},
|
},
|
||||||
button2: {
|
button2: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VIVE_CONTROLLER_CONFIGURATION_RIGHT = {
|
VIVE_CONTROLLER_CONFIGURATION_RIGHT = {
|
||||||
name: "Vive Right",
|
name: "Vive Right",
|
||||||
controllers: [
|
controllers: [
|
||||||
|
@ -192,20 +207,20 @@ VIVE_CONTROLLER_CONFIGURATION_RIGHT = {
|
||||||
defaultTextureLayer: "blank",
|
defaultTextureLayer: "blank",
|
||||||
textureLayers: {
|
textureLayers: {
|
||||||
blank: {
|
blank: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Blank.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Blank.png"
|
||||||
},
|
},
|
||||||
trigger: {
|
trigger: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Trigger.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Trigger.png"
|
||||||
},
|
},
|
||||||
arrows: {
|
arrows: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Rotate.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Rotate.png"
|
||||||
},
|
},
|
||||||
grip: {
|
grip: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Grip.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Grip.png"
|
||||||
},
|
},
|
||||||
teleport: {
|
teleport: {
|
||||||
defaultTextureURL: viveTipsModelURL + "/Controller-Tips.fbm/Teleport.png",
|
defaultTextureURL: TIP_TEXTURE_BASE_URL + "/Teleport.png"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -213,7 +228,7 @@ VIVE_CONTROLLER_CONFIGURATION_RIGHT = {
|
||||||
// and swaps in textures based on the thumb position.
|
// and swaps in textures based on the thumb position.
|
||||||
touchpad: {
|
touchpad: {
|
||||||
type: "touchpad",
|
type: "touchpad",
|
||||||
modelURL: "atp:/controller/vive_trackpad.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_trackpad.fbx",
|
||||||
visibleInput: "Vive.RSTouch",
|
visibleInput: "Vive.RSTouch",
|
||||||
xInput: "Vive.RX",
|
xInput: "Vive.RX",
|
||||||
yInput: "Vive.RY",
|
yInput: "Vive.RY",
|
||||||
|
@ -227,58 +242,58 @@ VIVE_CONTROLLER_CONFIGURATION_RIGHT = {
|
||||||
disable_defaultTextureLayer: "blank",
|
disable_defaultTextureLayer: "blank",
|
||||||
disable_textureLayers: {
|
disable_textureLayers: {
|
||||||
blank: {
|
blank: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-blank.jpg"
|
||||||
},
|
},
|
||||||
teleport: {
|
teleport: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-teleport-active-LG.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-teleport-active-LG.jpg"
|
||||||
},
|
},
|
||||||
arrows: {
|
arrows: {
|
||||||
defaultTextureURL: "atp:/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-look-arrows-active.jpg",
|
defaultTextureURL: BASE_URL + "meshes/controller/vive_trackpad.fbx/Touchpad.fbm/touchpad-look-arrows-active.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger: {
|
trigger: {
|
||||||
type: "rotational",
|
type: "rotational",
|
||||||
modelURL: "atp:/controller/vive_trigger.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_trigger.fbx",
|
||||||
input: Controller.Standard.RT,
|
input: Controller.Standard.RT,
|
||||||
naturalPosition: {"x":0.000004500150680541992,"y":-0.027690507471561432,"z":0.04830199480056763},
|
naturalPosition: {"x":0.000004500150680541992,"y":-0.027690507471561432,"z":0.04830199480056763},
|
||||||
origin: { x: 0, y: -0.015, z: -0.00 },
|
origin: { x: 0, y: -0.015, z: -0.00 },
|
||||||
minValue: 0.0,
|
minValue: 0.0,
|
||||||
maxValue: 1.0,
|
maxValue: 1.0,
|
||||||
axis: { x: -1, y: 0, z: 0 },
|
axis: { x: -1, y: 0, z: 0 },
|
||||||
maxAngle: 25,
|
maxAngle: 25
|
||||||
},
|
},
|
||||||
|
|
||||||
l_grip: {
|
l_grip: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_l_grip.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_l_grip.fbx",
|
||||||
naturalPosition: {"x":-0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226},
|
naturalPosition: {"x":-0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226}
|
||||||
},
|
},
|
||||||
|
|
||||||
r_grip: {
|
r_grip: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_r_grip.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_r_grip.fbx",
|
||||||
naturalPosition: {"x":0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226},
|
naturalPosition: {"x":0.01720449887216091,"y":-0.014324013143777847,"z":0.08714400231838226}
|
||||||
},
|
},
|
||||||
|
|
||||||
sys_button: {
|
sys_button: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_sys_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_sys_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.0020399854984134436,"z":0.08825899660587311},
|
naturalPosition: {"x":0,"y":0.0020399854984134436,"z":0.08825899660587311}
|
||||||
},
|
},
|
||||||
|
|
||||||
button: {
|
button: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
||||||
},
|
},
|
||||||
button2: {
|
button2: {
|
||||||
type: "static",
|
type: "static",
|
||||||
modelURL: "atp:/controller/vive_button.fbx",
|
modelURL: BASE_URL + "meshes/controller/vive_button.fbx",
|
||||||
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
naturalPosition: {"x":0,"y":0.005480996798723936,"z":0.019918499514460564}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
|
@ -9,7 +9,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
Script.include("entityData.js");
|
Script.include("entityData.js");
|
||||||
Script.include("viveHandsv2.js");
|
|
||||||
Script.include("lighter/createButaneLighter.js");
|
Script.include("lighter/createButaneLighter.js");
|
||||||
Script.include("tutorialEntityIDs.js");
|
Script.include("tutorialEntityIDs.js");
|
||||||
|
|
||||||
|
@ -235,7 +234,7 @@ var stepDisableControllers = function(name) {
|
||||||
}
|
}
|
||||||
stepDisableControllers.prototype = {
|
stepDisableControllers.prototype = {
|
||||||
start: function(onFinish) {
|
start: function(onFinish) {
|
||||||
controllerDisplayManager = new ControllerDisplayManager();
|
HMD.requestShowHandControllers();
|
||||||
disableEverything();
|
disableEverything();
|
||||||
|
|
||||||
onFinish();
|
onFinish();
|
||||||
|
@ -276,10 +275,7 @@ function reenableEverything() {
|
||||||
setControllerPartLayer('touchpad', 'blank');
|
setControllerPartLayer('touchpad', 'blank');
|
||||||
setControllerPartLayer('tips', 'blank');
|
setControllerPartLayer('tips', 'blank');
|
||||||
MyAvatar.shouldRenderLocally = true;
|
MyAvatar.shouldRenderLocally = true;
|
||||||
if (controllerDisplayManager) {
|
HMD.requestHideHandControllers();
|
||||||
controllerDisplayManager.destroy();
|
|
||||||
controllerDisplayManager = null;
|
|
||||||
}
|
|
||||||
setAwayEnabled(true);
|
setAwayEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|