Fix for Pico thumbstick movement & fixed typo

This commit is contained in:
Simon 2023-01-18 21:55:47 +00:00
parent f0a6d673ee
commit dad5ed29f7
3 changed files with 6 additions and 5 deletions

View file

@ -595,7 +595,7 @@ void TBXR_Vibrate( int duration, int chan, float intensity )
}
}
void TBXR_processHaptics() {
void TBXR_ProcessHaptics() {
static float lastFrameTime = 0.0f;
float timestamp = (float)(Sys_Milliseconds( ));
float frametime = timestamp - lastFrameTime;

View file

@ -84,14 +84,14 @@ float nonLinearFilter(float in)
float val = 0.0f;
if (in > NLF_DEADZONE)
{
val = in;
val = in > 1.0f ? 1.0f : in;
val -= NLF_DEADZONE;
val /= (1.0f - NLF_DEADZONE);
val = powf(val, NLF_POWER);
}
else if (in < -NLF_DEADZONE)
{
val = in;
val = in < -1.0f ? -1.0f : in;
val += NLF_DEADZONE;
val /= (1.0f - NLF_DEADZONE);
val = -powf(fabsf(val), NLF_POWER);

View file

@ -696,8 +696,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Apply a filter and quadratic scaler so small movements are easier to make
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
float nlf = nonLinearFilter(dist);
float x = (nlf * pSecondaryJoystick->x);
float y = (nlf * pSecondaryJoystick->y);
dist = (dist > 1.0f) ? dist : 1.0f;
float x = nlf * (pSecondaryJoystick->x / dist);
float y = nlf * (pSecondaryJoystick->y / dist);
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;