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
455bool ViveControllerManager::InputDevice::triggerHapticPulse(float strength, float duration, controller::Hand hand) {455bool 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}

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