diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4dc218ecdc..189234894d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2825,6 +2825,8 @@ void Application::update(float deltaTime) { } } + _controllerScriptingInterface->updateInputControllers(); + // Transfer the user inputs to the driveKeys // FIXME can we drop drive keys and just have the avatar read the action states directly? myAvatar->clearDriveKeys(); diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 719bfe7f1f..11053154b6 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -89,8 +89,7 @@ controller::InputController* ControllerScriptingInterface::createInputController auto icIt = _inputControllers.find(0); if (icIt != _inputControllers.end()) { return (*icIt).second.get(); - } - + } // Look for device DeviceTracker::ID deviceID = DeviceTracker::getDeviceID(deviceName.toStdString()); @@ -122,6 +121,12 @@ void ControllerScriptingInterface::releaseInputController(controller::InputContr _inputControllers.erase(input->getKey()); } +void ControllerScriptingInterface::updateInputControllers() { + for (auto it = _inputControllers.begin(); it != _inputControllers.end(); it++) { + (*it).second->update(); + } +} + InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) : _deviceTrackerId(deviceTrackerId), _subTrackerId(subTrackerId), diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index 22d8f8be1f..8bd698cfb2 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -85,6 +85,8 @@ public: bool isKeyCaptured(const KeyEvent& event) const; bool isJoystickCaptured(int joystickIndex) const; + void updateInputControllers(); + public slots: virtual void captureKeyEvents(const KeyEvent& event);