mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 02:04:57 +02:00
Fix UserInputMapper event generation
This commit is contained in:
parent
08ee5cbc17
commit
073567558e
2 changed files with 5 additions and 1 deletions
|
@ -226,9 +226,12 @@ void UserInputMapper::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale all the channel step with the scale
|
// Scale all the channel step with the scale
|
||||||
|
static const float EPSILON = 0.01f;
|
||||||
for (auto i = 0; i < NUM_ACTIONS; i++) {
|
for (auto i = 0; i < NUM_ACTIONS; i++) {
|
||||||
_actionStates[i] *= _actionScales[i];
|
_actionStates[i] *= _actionScales[i];
|
||||||
if (_actionStates[i] > 0) {
|
// Emit only on change, and emit when moving back to 0
|
||||||
|
if (fabs(_actionStates[i] - _lastActionStates[i]) > EPSILON) {
|
||||||
|
_lastActionStates[i] = _actionStates[i];
|
||||||
emit actionEvent(i, _actionStates[i]);
|
emit actionEvent(i, _actionStates[i]);
|
||||||
}
|
}
|
||||||
// TODO: emit signal for pose changes
|
// TODO: emit signal for pose changes
|
||||||
|
|
|
@ -248,6 +248,7 @@ protected:
|
||||||
|
|
||||||
std::vector<float> _actionStates = std::vector<float>(NUM_ACTIONS, 0.0f);
|
std::vector<float> _actionStates = std::vector<float>(NUM_ACTIONS, 0.0f);
|
||||||
std::vector<float> _actionScales = std::vector<float>(NUM_ACTIONS, 1.0f);
|
std::vector<float> _actionScales = std::vector<float>(NUM_ACTIONS, 1.0f);
|
||||||
|
std::vector<float> _lastActionStates = std::vector<float>(NUM_ACTIONS, 0.0f);
|
||||||
std::vector<PoseValue> _poseStates = std::vector<PoseValue>(NUM_ACTIONS);
|
std::vector<PoseValue> _poseStates = std::vector<PoseValue>(NUM_ACTIONS);
|
||||||
|
|
||||||
glm::mat4 _sensorToWorldMat;
|
glm::mat4 _sensorToWorldMat;
|
||||||
|
|
Loading…
Reference in a new issue