Remove the digital LX/LY hack from OpenXR and fix the too-sensitive controller settings

This commit is contained in:
Ada 2025-05-26 18:09:02 +10:00
parent eb40056231
commit bc305bf1d9
4 changed files with 3 additions and 31 deletions

View file

@ -19,7 +19,7 @@
"to": "Actions.StepYaw", "to": "Actions.StepYaw",
"filters": "filters":
[ [
{ "type": "deadZone", "min": 0.15 }, { "type": "deadZone", "min": 0.65 },
"constrainToInteger", "constrainToInteger",
{ "type": "pulse", "interval": 0.25 }, { "type": "pulse", "interval": 0.25 },
{ "type": "scale", "scale": 22.5 } { "type": "scale", "scale": 22.5 }
@ -37,7 +37,7 @@
"to": "Actions.StepYaw", "to": "Actions.StepYaw",
"filters": "filters":
[ [
{ "type": "deadZone", "min": 0.15 }, { "type": "deadZone", "min": 0.65 },
"constrainToInteger", "constrainToInteger",
{ "type": "pulse", "interval": 0.25 }, { "type": "pulse", "interval": 0.25 },
{ "type": "scale", "scale": 22.5 } { "type": "scale", "scale": 22.5 }

View file

@ -797,8 +797,6 @@ void OpenXrInputPlugin::InputDevice::update(float deltaTime, const controller::I
} }
} }
awfulRightStickHackForBrokenScripts();
if (_context->_stickEmulation) { if (_context->_stickEmulation) {
emulateStickFromTrackpad(); emulateStickFromTrackpad();
} }
@ -849,31 +847,6 @@ void OpenXrInputPlugin::InputDevice::emulateStickFromTrackpad() {
} }
} }
// FIXME: the vr controller scripts are horribly broken and don't work properly,
// this emulates a segmented vive trackpad to get teleport and snap turning behaving
void OpenXrInputPlugin::InputDevice::awfulRightStickHackForBrokenScripts() {
auto stick = _actions.at("right_thumbstick")->getVector2f().currentState;
_axisStateMap[controller::RX].value = 0.0f;
_axisStateMap[controller::RY].value = 0.0f;
if (stick.x < -0.6f && stick.y > -0.4f && stick.y < 0.4f) {
_axisStateMap[controller::RX].value = -1.0f;
}
if (stick.x > 0.6f && stick.y > -0.4f && stick.y < 0.4f) {
_axisStateMap[controller::RX].value = 1.0f;
}
if (stick.y > 0.6f && stick.x > -0.4f && stick.x < 0.4f) {
_axisStateMap[controller::RY].value = -1.0f;
}
if (stick.y < -0.6f && stick.x > -0.4f && stick.x < 0.4f) {
_axisStateMap[controller::RY].value = 1.0f;
}
}
void OpenXrInputPlugin::InputDevice::getHandTrackingInputs(int i, const mat4& sensorToAvatar) { void OpenXrInputPlugin::InputDevice::getHandTrackingInputs(int i, const mat4& sensorToAvatar) {
if (_handTracker[i] == XR_NULL_HANDLE) { return; } if (_handTracker[i] == XR_NULL_HANDLE) { return; }
if (!_context->_lastPredictedDisplayTime.has_value()) { return; } if (!_context->_lastPredictedDisplayTime.has_value()) { return; }

View file

@ -83,7 +83,6 @@ private:
bool triggerHapticPulse(float strength, float duration, uint16_t index) override; bool triggerHapticPulse(float strength, float duration, uint16_t index) override;
void emulateStickFromTrackpad(); void emulateStickFromTrackpad();
void awfulRightStickHackForBrokenScripts();
void getHandTrackingInputs(int index, const mat4& sensorToAvatar); void getHandTrackingInputs(int index, const mat4& sensorToAvatar);
mutable std::recursive_mutex _lock; mutable std::recursive_mutex _lock;

View file

@ -112,7 +112,7 @@ var TEAR_AWAY_DISTANCE = 0.15; // ungrab an entity if its bounding-box moves thi
var TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away var TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away
var TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks var TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks
var TELEPORT_DEADZONE = 0.15; var TELEPORT_DEADZONE = 0.65;
var NEAR_GRAB_DISTANCE = 0.14; // Grab an entity if its bounding box is within this distance. var NEAR_GRAB_DISTANCE = 0.14; // Grab an entity if its bounding box is within this distance.
// Smaller than TEAR_AWAY_DISTANCE for hysteresis. // Smaller than TEAR_AWAY_DISTANCE for hysteresis.