Showing the changes to plugins/openvr/src/ViveControllerManager.cpp (1 of 2 files). Show all
Unified · Split
| @@ -455,12 +455,22 @@ void ViveControllerManager::InputDevice::handlePoseEvent(float deltaTime, const · 454 unmodified lines | ||
| 455 | 455 | bool ViveControllerManager::InputDevice::triggerHapticPulse(float strength, float duration, controller::Hand hand) { |
| 456 | 456 | Locker locker(_lock); |
| 457 | 457 | 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 | + } | |
| 460 | 465 | } |
| 461 | 466 | 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 | + } | |
| 464 | 474 | } |
| 465 | 475 | return true; |
| 466 | 476 | } |