MCPcopy Create free account
hub / github.com/LibreVR/Revive / ApplyDeadzone

Method ApplyDeadzone

Revive/InputManager.cpp:350–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348/* Controller child-classes */
349
350OVR::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
368void InputManager::OculusTouch::HapticsThread(OculusTouch* device)
369{

Callers

nothing calls this directly

Calls 1

Vector2fClass · 0.70

Tested by

no test coverage detected