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 | bool ViveControllerManager::InputDevice::triggerHapticPulse(float strength, float duration, controller::Hand hand) { | 455 | bool ViveControllerManager::InputDevice::triggerHapticPulse(float strength, float duration, controller::Hand hand) { |
| 456 | Locker locker(_lock); | 456 | Locker locker(_lock); |
| 457 | if (hand == controller::BOTH || hand == controller::LEFT) { | 457 | if (hand == controller::BOTH || hand == controller::LEFT) { |
| 458 | _leftHapticStrength = (duration > _leftHapticDuration) ? strength : _leftHapticStrength; | 458 | if (strength == 0.0f) { |
| 459 | _leftHapticDuration = std::max(duration, _leftHapticDuration); | 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 | if (hand == controller::BOTH || hand == controller::RIGHT) { | 466 | if (hand == controller::BOTH || hand == controller::RIGHT) { |
| 462 | _rightHapticStrength = (duration > _rightHapticDuration) ? strength : _rightHapticStrength; | 467 | if (strength == 0.0f) { |
| 463 | _rightHapticDuration = std::max(duration, _rightHapticDuration); | 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 | return true; | 475 | return true; |
| 466 | } | 476 | } |