History

can set strength to 0

SamGondelman committed 10 years ago

Commit ff240541 parent 7a3cba82 files · +32 −12Browse files

Showing the changes to plugins/openvr/src/ViveControllerManager.cpp (1 of 2 files). Show all

Unified · Split

plugins/openvr/src/ViveControllerManager.cpp+14−4
@@ -455,12 +455,22 @@ void ViveControllerManager::InputDevice::handlePoseEvent(float deltaTime, const · 454 unmodified lines
455455 bool ViveControllerManager::InputDevice::triggerHapticPulse(float strength, float duration, controller::Hand hand) {
456456 Locker locker(_lock);
457457 if (hand == controller::BOTH || hand == controller::LEFT) {
458− _leftHapticStrength = (duration > _leftHapticDuration) ? strength : _leftHapticStrength;
459− _leftHapticDuration = std::max(duration, _leftHapticDuration);
458+ if (strength == 0.0f) {
459+ _leftHapticStrength = 0.0f;
460+ _leftHapticDuration = 0.0f;
461+ } else {
462+ _leftHapticStrength = (duration > _leftHapticDuration) ? strength : _leftHapticStrength;
463+ _leftHapticDuration = std::max(duration, _leftHapticDuration);
464+ }
460465 }
461466 if (hand == controller::BOTH || hand == controller::RIGHT) {
462− _rightHapticStrength = (duration > _rightHapticDuration) ? strength : _rightHapticStrength;
463− _rightHapticDuration = std::max(duration, _rightHapticDuration);
467+ if (strength == 0.0f) {
468+ _rightHapticStrength = 0.0f;
469+ _rightHapticDuration = 0.0f;
470+ } else {
471+ _rightHapticStrength = (duration > _rightHapticDuration) ? strength : _rightHapticStrength;
472+ _rightHapticDuration = std::max(duration, _rightHapticDuration);
473+ }
464474 }
465475 return true;
466476 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t