mirror of
https://github.com/overte-org/overte.git
synced 2025-04-24 05:53:29 +02:00
Merge pull request #5659 from jherico/nelson
Fix UserInputMapper event generation
This commit is contained in:
commit
5d5c1584c3
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
|
||||
static const float EPSILON = 0.01f;
|
||||
for (auto i = 0; i < NUM_ACTIONS; 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]);
|
||||
}
|
||||
// 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> _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);
|
||||
|
||||
glm::mat4 _sensorToWorldMat;
|
||||
|
|
Loading…
Reference in a new issue