History

can set strength to 0

SamGondelman committed 10 years ago

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

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

Unified · Split

plugins/oculus/src/OculusControllerManager.cpp+18−8
@@ -253,18 +253,28 @@ bool OculusControllerManager::TouchDevice::triggerHapticPulse(float strength, fl · 252 unmodified lines
253 Locker locker(_lock);253 Locker locker(_lock);
254 bool toReturn = true;254 bool toReturn = true;
255 if (hand == controller::BOTH || hand == controller::LEFT) {255 if (hand == controller::BOTH || hand == controller::LEFT) {
256 _leftHapticStrength = (duration > _leftHapticDuration) ? strength : _leftHapticStrength;256 if (strength == 0.0f) {
257 if (ovr_SetControllerVibration(_parent._session, ovrControllerType_LTouch, 1.0f, _leftHapticStrength) != ovrSuccess) {257 _leftHapticStrength = 0.0f;
258 toReturn = false;258 _leftHapticDuration = 0.0f;
259 } else {
260 _leftHapticStrength = (duration > _leftHapticDuration) ? strength : _leftHapticStrength;
261 if (ovr_SetControllerVibration(_parent._session, ovrControllerType_LTouch, 1.0f, _leftHapticStrength) != ovrSuccess) {
262 toReturn = false;
263 }
264 _leftHapticDuration = std::max(duration, _leftHapticDuration);
259 }265 }
260 _leftHapticDuration = std::max(duration, _leftHapticDuration);
261 }266 }
262 if (hand == controller::BOTH || hand == controller::RIGHT) {267 if (hand == controller::BOTH || hand == controller::RIGHT) {
263 _rightHapticStrength = (duration > _rightHapticDuration) ? strength : _rightHapticStrength;268 if (strength == 0.0f) {
264 if (ovr_SetControllerVibration(_parent._session, ovrControllerType_RTouch, 1.0f, _rightHapticStrength) != ovrSuccess) {269 _rightHapticStrength = 0.0f;
265 toReturn = false;270 _rightHapticDuration = 0.0f;
271 } else {
272 _rightHapticStrength = (duration > _rightHapticDuration) ? strength : _rightHapticStrength;
273 if (ovr_SetControllerVibration(_parent._session, ovrControllerType_RTouch, 1.0f, _rightHapticStrength) != ovrSuccess) {
274 toReturn = false;
275 }
276 _rightHapticDuration = std::max(duration, _rightHapticDuration);
266 }277 }
267 _rightHapticDuration = std::max(duration, _rightHapticDuration);
268 }278 }
269 return toReturn;279 return toReturn;
270}280}