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
8// Distributed under the Apache License, Version 2.0.8// Distributed under the Apache License, Version 2.0.
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//10//
11#include "UserInputMapper.h"
12#include <algorithm>11#include <algorithm>
13 12
13#include "Application.h"
14
15#include "UserInputMapper.h"
16
14 17
15// UserInputMapper Class18// UserInputMapper Class
16 19
@@ -207,6 +210,9 @@ void UserInputMapper::update(float deltaTime) { · 190 unmodified lines
207 // Scale all the channel step with the scale210 // Scale all the channel step with the scale
208 for (auto i = 0; i < NUM_ACTIONS; i++) {211 for (auto i = 0; i < NUM_ACTIONS; i++) {
209 _actionStates[i] *= _actionScales[i];212 _actionStates[i] *= _actionScales[i];
213 if (_actionStates[i] > 0) {
214 emit Application::getInstance()->getControllerScriptingInterface()->actionEvent(i, _actionStates[i]);
215 }
210 }216 }
211}217}
212 218
@@ -241,6 +247,9 @@ void UserInputMapper::assignDefaulActionScales() { · 28 unmodified lines
241 _actionScales[PITCH_UP] = 1.0f; // 1 degree per unit247 _actionScales[PITCH_UP] = 1.0f; // 1 degree per unit
242 _actionScales[BOOM_IN] = 1.0f; // 1m per unit248 _actionScales[BOOM_IN] = 1.0f; // 1m per unit
243 _actionScales[BOOM_OUT] = 1.0f; // 1m per unit249 _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
244}253}
245 254
246// This is only necessary as long as the actions are hardcoded255// This is only necessary as long as the actions are hardcoded
@@ -258,4 +267,7 @@ void UserInputMapper::createActionNames() { · 11 unmodified lines
258 _actionNames[PITCH_UP] = "PITCH_UP";267 _actionNames[PITCH_UP] = "PITCH_UP";
259 _actionNames[BOOM_IN] = "BOOM_IN";268 _actionNames[BOOM_IN] = "BOOM_IN";
260 _actionNames[BOOM_OUT] = "BOOM_OUT";269 _actionNames[BOOM_OUT] = "BOOM_OUT";
270 _actionNames[SHIFT] = "SHIFT";
271 _actionNames[ACTION1] = "ACTION1";
272 _actionNames[ACTION2] = "ACTION2";
261}273}