diff --git a/examples/controllers/handPosesDebug.js b/examples/controllers/handPosesDebug.js
index 6c933b2565..3eabee8f53 100644
--- a/examples/controllers/handPosesDebug.js
+++ b/examples/controllers/handPosesDebug.js
@@ -32,6 +32,7 @@ var RIGHT_HAND = 1;
var COLORS = [ { red: 255, green: 0, blue: 0 }, { red: 0, green: 0, blue: 255 } ];
+
function index(handNum, indexNum) {
return handNum * NUM_HANDS + indexNum;
}
@@ -84,9 +85,46 @@ function updateHand(handNum, deltaTime) {
}
}
+function updateHydra(handNum, deltaTime) {
+ var pose;
+ var handName = "right";
+ if (handNum == LEFT_HAND) {
+ pose = Controller.getPoseValue(Controller.Hardware.Hydra.LeftHand);
+ handName = "left";
+ } else {
+ pose = Controller.getPoseValue(Controller.Hardware.Hydra.RightHand);
+ handName = "right";
+ }
+
+ if (pose.valid) {
+ //print(handName + " hand moving" + JSON.stringify(pose));
+ var wpos = Vec3.sum(MyAvatar.getPosition(), pose.translation);
+
+ Overlays.editOverlay(app.spheres[index(handNum, 0)], {
+ position: pose.translation,
+ visible: true,
+ });
+ /*var vpos = Vec3.sum(Vec3.multiply(10 * deltaTime, pose.velocity), pose.translation);
+ Overlays.editOverlay(app.spheres[index(handNum, 1)], {
+ position: vpos,
+ visible: true,
+ });*/
+ } else {
+ Overlays.editOverlay(app.spheres[index(handNum, 0)], {
+ visible: false
+ });
+
+ Overlays.editOverlay(app.spheres[index(handNum, 1)], {
+ visible: false
+ });
+ }
+}
+
function update(deltaTime) {
- updateHand(LEFT_HAND, deltaTime);
- updateHand(RIGHT_HAND, deltaTime);
+ //updateHand(LEFT_HAND, deltaTime);
+ //updateHand(RIGHT_HAND, deltaTime);
+ updateHydra(LEFT_HAND, deltaTime);
+ updateHydra(RIGHT_HAND, deltaTime);
}
function scriptEnding() {
diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json
index 20177bfc5e..69193b40c5 100644
--- a/interface/resources/controllers/standard.json
+++ b/interface/resources/controllers/standard.json
@@ -3,8 +3,7 @@
"channels": [
{ "from": "Standard.LY", "to": "Actions.TranslateZ" },
{ "from": "Standard.LX", "to": "Actions.TranslateX" },
- { "from": "Standard.RX", "with": "Actions.InHMD", "to": "Actions.StepYaw" },
- { "from": "Standard.RX", "to": "Actions.Yaw" },
+ { "from": "Standard.RX", "to": "Actions.Yaw" },
{ "from": "Standard.RY", "to": "Actions.Pitch" },
{ "from": [ "Standard.DU", "Standard.DU", "Standard.DU", "Standard.DD" ], "to": "Standard.LeftPrimaryThumb" },
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index c1257e1279..403da6ddc5 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -2707,7 +2707,7 @@ void Application::update(float deltaTime) {
userInputMapper->resetActionState(controller::Action::IN_HMD, (float)qApp->getAvatarUpdater()->isHMDMode());
userInputMapper->setSensorToWorldMat(myAvatar->getSensorToWorldMatrix());
- userInputMapper->update(deltaTime);
+ // userInputMapper->update(deltaTime);
bool jointsCaptured = false;
for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) {
@@ -2718,6 +2718,7 @@ void Application::update(float deltaTime) {
}
}
}
+ userInputMapper->update(deltaTime);
// Transfer the user inputs to the driveKeys
// FIXME can we drop drive keys and just have the avatar read the action states directly?
diff --git a/libraries/controllers/src/controllers/DeviceProxy.cpp b/libraries/controllers/src/controllers/DeviceProxy.cpp
index 6cbfc1048d..1bd65d4900 100644
--- a/libraries/controllers/src/controllers/DeviceProxy.cpp
+++ b/libraries/controllers/src/controllers/DeviceProxy.cpp
@@ -26,6 +26,5 @@ namespace controller {
return NAN;
}
}
-
}
diff --git a/libraries/controllers/src/controllers/DeviceProxy.h b/libraries/controllers/src/controllers/DeviceProxy.h
index 064abdbc7f..5f94e748f7 100644
--- a/libraries/controllers/src/controllers/DeviceProxy.h
+++ b/libraries/controllers/src/controllers/DeviceProxy.h
@@ -23,7 +23,8 @@ namespace controller {
using Modifiers = std::vector;
typedef QPair InputPair;
-
+ class Endpoint;
+ using EndpointPtr = std::shared_ptr;
template
using InputGetter = std::function;
@@ -32,6 +33,7 @@ namespace controller {
using PoseGetter = InputGetter;
using ResetBindings = std::function;
using AvailableInputGetter = std::function;
+ using EndpointCreator = std::function;
class DeviceProxy {
public:
@@ -42,6 +44,9 @@ namespace controller {
PoseGetter getPose = [](const Input& input, int timestamp) -> Pose { return Pose(); };
AvailableInputGetter getAvailabeInputs = []() -> Input::NamedVector const { return Input::NamedVector(); };
float getValue(const Input& input, int timestamp = 0) const;
+
+ EndpointCreator createEndpoint = [](const Input& input) -> EndpointPtr { return EndpointPtr(); };
+
QString _name;
};
}
diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp
index 67a9fdc244..8539083265 100755
--- a/libraries/controllers/src/controllers/UserInputMapper.cpp
+++ b/libraries/controllers/src/controllers/UserInputMapper.cpp
@@ -43,6 +43,7 @@
namespace controller {
const uint16_t UserInputMapper::ACTIONS_DEVICE = Input::INVALID_DEVICE - 0xFF;
+ const uint16_t UserInputMapper::STATE_DEVICE = ACTIONS_DEVICE - 0xFF;
const uint16_t UserInputMapper::STANDARD_DEVICE = 0;
}
@@ -89,13 +90,16 @@ void UserInputMapper::registerDevice(InputDevice* device) {
if (_endpointsByInput.count(input)) {
continue;
}
- Endpoint::Pointer endpoint;
- if (input.device == STANDARD_DEVICE) {
- endpoint = std::make_shared(input);
- } else if (input.device == ACTIONS_DEVICE) {
- endpoint = std::make_shared(input);
- } else {
- endpoint = std::make_shared(input);
+
+ Endpoint::Pointer endpoint = proxy->createEndpoint(input);
+ if (!endpoint) {
+ if (input.device == STANDARD_DEVICE) {
+ endpoint = std::make_shared(input);
+ } else if (input.device == ACTIONS_DEVICE) {
+ endpoint = std::make_shared(input);
+ } else {
+ endpoint = std::make_shared(input);
+ }
}
_inputsByEndpoint[endpoint] = input;
_endpointsByInput[input] = endpoint;
@@ -1020,7 +1024,7 @@ void UserInputMapper::disableMapping(const Mapping::Pointer& mapping) {
void UserInputMapper::resetActionState(Action action, float value) {
auto endpoint = endpointFor(inputFromAction(action));
if (endpoint) {
- endpoint->apply(value, 0.0f, Endpoint::Pointer());
+ endpoint->apply(value, Endpoint::Pointer());
}
_actionStates[toInt(action)] = value;
}
diff --git a/libraries/controllers/src/controllers/UserInputMapper.h b/libraries/controllers/src/controllers/UserInputMapper.h
index 40fe26aff3..311d54c11c 100644
--- a/libraries/controllers/src/controllers/UserInputMapper.h
+++ b/libraries/controllers/src/controllers/UserInputMapper.h
@@ -58,6 +58,7 @@ namespace controller {
static const uint16_t ACTIONS_DEVICE;
static const uint16_t STANDARD_DEVICE;
+ static const uint16_t STATE_DEVICE;
UserInputMapper();
virtual ~UserInputMapper();