| 348 | /* Controller child-classes */ |
| 349 | |
| 350 | OVR::Vector2f InputManager::InputDevice::ApplyDeadzone(OVR::Vector2f axis, float deadZoneLow, float deadZoneHigh) |
| 351 | { |
| 352 | float mag = axis.Length(); |
| 353 | if (mag > deadZoneLow) |
| 354 | { |
| 355 | // scale such that output magnitude is in the range[0, 1] |
| 356 | float legalRange = 1.0f - deadZoneHigh - deadZoneLow; |
| 357 | float normalizedMag = std::min(1.0f, (mag - deadZoneLow) / legalRange); |
| 358 | float scale = normalizedMag / mag; |
| 359 | return axis * scale; |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | // stick is in the inner dead zone |
| 364 | return OVR::Vector2f(); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | void InputManager::OculusTouch::HapticsThread(OculusTouch* device) |
| 369 | { |