History

Merge pull request #5167 from SamGondelman/hmdControls

hmdControls.js for movement when wearing an HMD

Ryan Huffman committed 11 years ago

Commit 4df1bea2 parents 584ecf7 a0d4b7e14 files · +350 −43Browse files

Showing the changes to interface/src/ui/UserInputMapper.cpp (1 of 14 files). Show all

Unified · Split

interface/src/ui/UserInputMapper.cpp+13−1
@@ -8,9 +8,12 @@ · 7 unmodified lines
88 // Distributed under the Apache License, Version 2.0.
99 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
1010 //
11−#include "UserInputMapper.h"
1211 #include <algorithm>
1312
13+#include "Application.h"
14+
15+#include "UserInputMapper.h"
16+
1417
1518 // UserInputMapper Class
1619
@@ -207,6 +210,9 @@ void UserInputMapper::update(float deltaTime) { · 190 unmodified lines
207210 // Scale all the channel step with the scale
208211 for (auto i = 0; i < NUM_ACTIONS; i++) {
209212 _actionStates[i] *= _actionScales[i];
213+ if (_actionStates[i] > 0) {
214+ emit Application::getInstance()->getControllerScriptingInterface()->actionEvent(i, _actionStates[i]);
215+ }
210216 }
211217 }
212218
@@ -241,6 +247,9 @@ void UserInputMapper::assignDefaulActionScales() { · 28 unmodified lines
241247 _actionScales[PITCH_UP] = 1.0f; // 1 degree per unit
242248 _actionScales[BOOM_IN] = 1.0f; // 1m per unit
243249 _actionScales[BOOM_OUT] = 1.0f; // 1m per unit
250+ _actionStates[SHIFT] = 1.0f; // on
251+ _actionStates[ACTION1] = 1.0f; // default
252+ _actionStates[ACTION2] = 1.0f; // default
244253 }
245254
246255 // This is only necessary as long as the actions are hardcoded
@@ -258,4 +267,7 @@ void UserInputMapper::createActionNames() { · 11 unmodified lines
258267 _actionNames[PITCH_UP] = "PITCH_UP";
259268 _actionNames[BOOM_IN] = "BOOM_IN";
260269 _actionNames[BOOM_OUT] = "BOOM_OUT";
270+ _actionNames[SHIFT] = "SHIFT";
271+ _actionNames[ACTION1] = "ACTION1";
272+ _actionNames[ACTION2] = "ACTION2";
261273 }