mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-29 11:10:11 +02:00
Merge pull request #6314 from jherico/homer
Fixing step yaw to move by consistent amounts, be 'tappable'
This commit is contained in:
commit
00797b4dea
4 changed files with 45 additions and 14 deletions
|
@ -12,28 +12,49 @@
|
||||||
{ "from": "Keyboard.W", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
|
{ "from": "Keyboard.W", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
|
||||||
|
|
||||||
|
|
||||||
{ "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] },
|
{ "comment" : "Mouse turn need to be small continuous increments",
|
||||||
|
"from": { "makeAxis" : [
|
||||||
|
[ "Keyboard.MouseMoveLeft" ],
|
||||||
|
[ "Keyboard.MouseMoveRight" ]
|
||||||
|
]
|
||||||
|
},
|
||||||
"when": [ "Application.InHMD", "Application.ComfortMode", "Keyboard.RightMouseButton" ],
|
"when": [ "Application.InHMD", "Application.ComfortMode", "Keyboard.RightMouseButton" ],
|
||||||
"to": "Actions.StepYaw",
|
"to": "Actions.StepYaw",
|
||||||
"filters":
|
"filters":
|
||||||
[
|
[
|
||||||
"constrainToInteger",
|
"constrainToInteger",
|
||||||
{ "type": "pulse", "interval": 0.5 },
|
{ "type": "pulse", "interval": 0.2 },
|
||||||
{ "type": "scale", "scale": 15 }
|
{ "type": "scale", "scale": 22.5 }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "from": { "makeAxis" : [
|
{ "comment" : "Touchpad turn need to be small continuous increments, but without the RMB constraint",
|
||||||
["Keyboard.A", "Keyboard.Left", "Keyboard.TouchpadLeft"],
|
"from": { "makeAxis" : [
|
||||||
["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"]
|
[ "Keyboard.TouchpadLeft" ],
|
||||||
|
[ "Keyboard.TouchpadRight" ]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"when": [ "Application.InHMD", "Application.ComfortMode" ],
|
"when": [ "Application.InHMD", "Application.ComfortMode" ],
|
||||||
"to": "Actions.StepYaw",
|
"to": "Actions.StepYaw",
|
||||||
"filters":
|
"filters":
|
||||||
[
|
[
|
||||||
{ "type": "pulse", "interval": 0.5 },
|
"constrainToInteger",
|
||||||
{ "type": "scale", "scale": 15 }
|
{ "type": "pulse", "interval": 0.2 },
|
||||||
|
{ "type": "scale", "scale": 22.5 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "from": { "makeAxis" : [
|
||||||
|
["Keyboard.A", "Keyboard.Left" ],
|
||||||
|
["Keyboard.D", "Keyboard.Right"]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"when": [ "Application.InHMD", "Application.ComfortMode" ],
|
||||||
|
"to": "Actions.StepYaw",
|
||||||
|
"filters":
|
||||||
|
[
|
||||||
|
{ "type": "pulse", "interval": 0.5, "resetOnZero": true },
|
||||||
|
{ "type": "scale", "scale": 22.5 }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2794,7 +2794,7 @@ void Application::update(float deltaTime) {
|
||||||
float timeFactor = EXPECTED_FRAME_RATE * deltaTime;
|
float timeFactor = EXPECTED_FRAME_RATE * deltaTime;
|
||||||
myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH) / timeFactor);
|
myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH) / timeFactor);
|
||||||
myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW) / timeFactor);
|
myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW) / timeFactor);
|
||||||
myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW) / timeFactor);
|
myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myAvatar->setDriveKeys(ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z));
|
myAvatar->setDriveKeys(ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z));
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
using namespace controller;
|
using namespace controller;
|
||||||
|
|
||||||
|
const float PulseFilter::DEFAULT_LAST_EMIT_TIME = -::std::numeric_limits<float>::max();
|
||||||
|
|
||||||
float PulseFilter::apply(float value) const {
|
float PulseFilter::apply(float value) const {
|
||||||
float result = 0.0f;
|
float result = 0.0f;
|
||||||
|
@ -25,13 +25,22 @@ float PulseFilter::apply(float value) const {
|
||||||
_lastEmitTime = now;
|
_lastEmitTime = now;
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
} else if (_resetOnZero) {
|
||||||
|
_lastEmitTime = DEFAULT_LAST_EMIT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PulseFilter::parseParameters(const QJsonValue& parameters) {
|
bool PulseFilter::parseParameters(const QJsonValue& parameters) {
|
||||||
static const QString JSON_MIN = QStringLiteral("interval");
|
static const QString JSON_INTERVAL = QStringLiteral("interval");
|
||||||
return parseSingleFloatParameter(parameters, JSON_MIN, _interval);
|
static const QString JSON_RESET = QStringLiteral("resetOnZero");
|
||||||
|
if (parameters.isObject()) {
|
||||||
|
auto obj = parameters.toObject();
|
||||||
|
if (obj.contains(JSON_RESET)) {
|
||||||
|
_resetOnZero = obj[JSON_RESET].toBool();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parseSingleFloatParameter(parameters, JSON_INTERVAL, _interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,15 @@ public:
|
||||||
PulseFilter() {}
|
PulseFilter() {}
|
||||||
PulseFilter(float interval) : _interval(interval) {}
|
PulseFilter(float interval) : _interval(interval) {}
|
||||||
|
|
||||||
|
|
||||||
virtual float apply(float value) const override;
|
virtual float apply(float value) const override;
|
||||||
|
|
||||||
virtual bool parseParameters(const QJsonValue& parameters);
|
virtual bool parseParameters(const QJsonValue& parameters);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable float _lastEmitTime { -::std::numeric_limits<float>::max() };
|
static const float DEFAULT_LAST_EMIT_TIME;
|
||||||
float _interval = 1.0f;
|
mutable float _lastEmitTime { DEFAULT_LAST_EMIT_TIME };
|
||||||
|
bool _resetOnZero { false };
|
||||||
|
float _interval { 1.0f };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue