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

Method ApplyDeadzone

ReviveXR/InputManager.cpp:357–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357ovrVector2f InputManager::InputDevice::ApplyDeadzone(ovrVector2f axis, float deadZone)
358{
359 XR::Vector2f vector(axis);
360 float mag = vector.Length();
361 if (mag > deadZone)
362 {
363 // scale such that output magnitude is in the range[0, 1]
364 float legalRange = 1.0f - deadZone;
365 float normalizedMag = std::min(1.0f, (mag - deadZone) / legalRange);
366 float scale = normalizedMag / mag;
367 return vector * scale;
368 }
369 else
370 {
371 // stick is in the inner dead zone
372 return OVR::Vector2f();
373 }
374}
375
376ovrButton InputManager::InputDevice::TrackpadToDPad(ovrVector2f trackpad)
377{

Callers

nothing calls this directly

Calls 1

Vector2fClass · 0.70

Tested by

no test coverage detected